diff options
| author | Mark Brown <broonie@kernel.org> | 2026-06-10 14:21:16 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-06-10 14:21:16 +0300 |
| commit | 4bc343bd77e399528bc841a3bb520773363fddd5 (patch) | |
| tree | a90bf5f58de06a7f2ca11c34058ec01398ac373d | |
| parent | aa283db3bb8dba918a28016305ebc2046f3bf2e2 (diff) | |
| parent | cd849a5fcac849a2c9d9391a2676bf3d0b4443dd (diff) | |
| download | linux-4bc343bd77e399528bc841a3bb520773363fddd5.tar.xz | |
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
| -rw-r--r-- | include/sound/soc-component.h | 3 | ||||
| -rw-r--r-- | sound/soc/fsl/imx-pcm-rpmsg.c | 12 | ||||
| -rw-r--r-- | sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 39 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 9 | ||||
| -rw-r--r-- | sound/soc/soc-generic-dmaengine-pcm.c | 5 | ||||
| -rw-r--r-- | sound/soc/stm/stm32_adfsdm.c | 19 |
6 files changed, 13 insertions, 74 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 7e158d27ae8d..11bc9527653f 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -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)\ diff --git a/sound/soc/fsl/imx-pcm-rpmsg.c b/sound/soc/fsl/imx-pcm-rpmsg.c index 031e5272215d..2a4813c6cda9 100644 --- a/sound/soc/fsl/imx-pcm-rpmsg.c +++ b/sound/soc/fsl/imx-pcm-rpmsg.c @@ -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: diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index c0fa623e0b17..69cadc91c97f 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -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) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e96dd4a3f46c..b8c9ddfc4490 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -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); diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 6b8c65763c82..467426d2b5e4 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -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; diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index a585cb9fc011..66efb9a0acb9 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c @@ -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__); |
