mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
ASoC: remove .debugfs_prefix from Component
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> says: Basically, we are assuming to use snd_soc_register_component() (X) to register Component. It requests Component driver (A). And, current Component has .debugfs_prefix (B). Now we can set component->debugfs_prefix (B) via component_driver->debugfs_prefix (A) today. But some drivers are still trying to set it via (B). Thus, they need to use snd_soc_component_initialize() (1) / snd_soc_component_add() (2) instead of (X), because they need to access component->debugfs_prefix (B). These functions (= 1, 2) should be capsuled into soc-xxx.c, but can't because of above drivers. This patch-set removes component->debugfs_prefix (B). The functions (= 1, 2) are still not yet be capsuled. This is step1 for it, step2 will be posted after this. Link: https://patch.msgid.link/87ldcxk5wz.wl-kuninori.morimoto.gx@renesas.com
This commit is contained in:
@@ -199,9 +199,7 @@ struct snd_soc_component_driver {
|
||||
bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */
|
||||
int be_pcm_base; /* base device ID for all BE PCMs */
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
const char *debugfs_prefix;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct snd_soc_component {
|
||||
@@ -250,7 +248,6 @@ struct snd_soc_component {
|
||||
void *mark_pm;
|
||||
|
||||
struct dentry *debugfs_root;
|
||||
const char *debugfs_prefix;
|
||||
};
|
||||
|
||||
#define for_each_component_dais(component, dai)\
|
||||
|
||||
@@ -632,6 +632,7 @@ static const struct snd_soc_component_driver imx_rpmsg_soc_component = {
|
||||
.pointer = imx_rpmsg_pcm_pointer,
|
||||
.ack = imx_rpmsg_pcm_ack,
|
||||
.prepare = imx_rpmsg_pcm_prepare,
|
||||
.debugfs_prefix = "rpmsg",
|
||||
};
|
||||
|
||||
static void imx_rpmsg_pcm_work(struct work_struct *work)
|
||||
@@ -689,7 +690,6 @@ static void imx_rpmsg_pcm_work(struct work_struct *work)
|
||||
|
||||
static int imx_rpmsg_pcm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_component *component;
|
||||
struct rpmsg_info *info;
|
||||
int ret, i;
|
||||
|
||||
@@ -741,16 +741,6 @@ static int imx_rpmsg_pcm_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
component = snd_soc_lookup_component(&pdev->dev, NULL);
|
||||
if (!component) {
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
component->debugfs_prefix = "rpmsg";
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
||||
@@ -676,6 +676,7 @@ static const struct snd_soc_component_driver mt8173_afe_pcm_dai_component = {
|
||||
.num_dapm_routes = ARRAY_SIZE(mt8173_afe_pcm_routes),
|
||||
.suspend = mtk_afe_suspend,
|
||||
.resume = mtk_afe_resume,
|
||||
.debugfs_prefix = "pcm",
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver mt8173_afe_hdmi_dai_component = {
|
||||
@@ -684,6 +685,7 @@ static const struct snd_soc_component_driver mt8173_afe_hdmi_dai_component = {
|
||||
.num_dapm_routes = ARRAY_SIZE(mt8173_afe_hdmi_routes),
|
||||
.suspend = mtk_afe_suspend,
|
||||
.resume = mtk_afe_resume,
|
||||
.debugfs_prefix = "hdmi",
|
||||
};
|
||||
|
||||
static const char *aud_clks[MT8173_CLK_NUM] = {
|
||||
@@ -1053,7 +1055,6 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
|
||||
int irq_id;
|
||||
struct mtk_base_afe *afe;
|
||||
struct mt8173_afe_private *afe_priv;
|
||||
struct snd_soc_component *comp_pcm, *comp_hdmi;
|
||||
struct device *dev = &pdev->dev;
|
||||
|
||||
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
|
||||
@@ -1141,45 +1142,13 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
|
||||
comp_pcm = devm_kzalloc(dev, sizeof(*comp_pcm), GFP_KERNEL);
|
||||
if (!comp_pcm) {
|
||||
ret = -ENOMEM;
|
||||
goto err_pm_disable;
|
||||
}
|
||||
|
||||
ret = snd_soc_component_initialize(comp_pcm,
|
||||
&mt8173_afe_pcm_dai_component,
|
||||
dev);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
comp_pcm->debugfs_prefix = "pcm";
|
||||
#endif
|
||||
|
||||
ret = snd_soc_add_component(comp_pcm,
|
||||
ret = snd_soc_register_component(dev, &mt8173_afe_pcm_dai_component,
|
||||
mt8173_afe_pcm_dais,
|
||||
ARRAY_SIZE(mt8173_afe_pcm_dais));
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
|
||||
comp_hdmi = devm_kzalloc(dev, sizeof(*comp_hdmi), GFP_KERNEL);
|
||||
if (!comp_hdmi) {
|
||||
ret = -ENOMEM;
|
||||
goto err_cleanup_components;
|
||||
}
|
||||
|
||||
ret = snd_soc_component_initialize(comp_hdmi,
|
||||
&mt8173_afe_hdmi_dai_component,
|
||||
dev);
|
||||
if (ret)
|
||||
goto err_cleanup_components;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
comp_hdmi->debugfs_prefix = "hdmi";
|
||||
#endif
|
||||
|
||||
ret = snd_soc_add_component(comp_hdmi,
|
||||
ret = snd_soc_register_component(dev, &mt8173_afe_hdmi_dai_component,
|
||||
mt8173_afe_hdmi_dais,
|
||||
ARRAY_SIZE(mt8173_afe_hdmi_dais));
|
||||
if (ret)
|
||||
|
||||
@@ -136,11 +136,11 @@ static void soc_init_component_debugfs(struct snd_soc_component *component)
|
||||
if (!component->card->debugfs_card_root)
|
||||
return;
|
||||
|
||||
if (component->debugfs_prefix) {
|
||||
if (component->driver->debugfs_prefix) {
|
||||
char *name;
|
||||
|
||||
name = kasprintf(GFP_KERNEL, "%s:%s",
|
||||
component->debugfs_prefix, component->name);
|
||||
component->driver->debugfs_prefix, component->name);
|
||||
if (name) {
|
||||
component->debugfs_root = debugfs_create_dir(name,
|
||||
component->card->debugfs_card_root);
|
||||
@@ -2847,11 +2847,6 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
|
||||
component->dev = dev;
|
||||
component->driver = driver;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
if (!component->debugfs_prefix)
|
||||
component->debugfs_prefix = driver->debugfs_prefix;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_initialize);
|
||||
|
||||
@@ -334,6 +334,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
|
||||
.pointer = dmaengine_pcm_pointer,
|
||||
.pcm_new = dmaengine_pcm_new,
|
||||
.sync_stop = dmaengine_pcm_sync_stop,
|
||||
.debugfs_prefix = "dma",
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
|
||||
@@ -347,6 +348,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
|
||||
.copy = dmaengine_copy,
|
||||
.pcm_new = dmaengine_pcm_new,
|
||||
.sync_stop = dmaengine_pcm_sync_stop,
|
||||
.debugfs_prefix = "dma",
|
||||
};
|
||||
|
||||
static const char * const dmaengine_pcm_dma_channel_names[] = {
|
||||
@@ -441,9 +443,6 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
||||
if (!pcm)
|
||||
return -ENOMEM;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
pcm->component.debugfs_prefix = "dma";
|
||||
#endif
|
||||
if (!config)
|
||||
config = &snd_dmaengine_pcm_default_config;
|
||||
pcm->config = config;
|
||||
|
||||
@@ -312,6 +312,7 @@ static const struct snd_soc_component_driver stm32_adfsdm_soc_platform = {
|
||||
.trigger = stm32_adfsdm_trigger,
|
||||
.pointer = stm32_adfsdm_pcm_pointer,
|
||||
.pcm_new = stm32_adfsdm_pcm_new,
|
||||
.debugfs_prefix = "pcm",
|
||||
};
|
||||
|
||||
static const struct of_device_id stm32_adfsdm_of_match[] = {
|
||||
@@ -323,7 +324,6 @@ MODULE_DEVICE_TABLE(of, stm32_adfsdm_of_match);
|
||||
static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct stm32_adfsdm_priv *priv;
|
||||
struct snd_soc_component *component;
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -357,20 +357,9 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
component = devm_kzalloc(&pdev->dev, sizeof(*component), GFP_KERNEL);
|
||||
if (!component)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = snd_soc_component_initialize(component,
|
||||
&stm32_adfsdm_soc_platform,
|
||||
&pdev->dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
component->debugfs_prefix = "pcm";
|
||||
#endif
|
||||
|
||||
ret = snd_soc_add_component(component, NULL, 0);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&stm32_adfsdm_soc_platform,
|
||||
NULL, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
|
||||
__func__);
|
||||
|
||||
Reference in New Issue
Block a user