From 8fec6e55859e31b354207a46c16de3e12116d32f Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:31 +0000 Subject: [PATCH 1/6] ASoC: soc-component: remove CONFIG_DEBUG_FS for debugfs_prefix Both (A) and (B) have debugfs_prefix, but (B) is using CONFIG_DEBUG_FS (C) (A) struct snd_soc_component { ... const char *debugfs_prefix; }; (B) struct snd_soc_component_driver { ... (C) ifdef CONFIG_DEBUG_FS const char *debugfs_prefix; endif }; Remove (C) which makes code cleanup difficult. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87jyshk5wc.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 7e158d27ae8d..337b7ef4156c 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 { From 23dff77e302503af7023a95e7115621de07ad525 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:41 +0000 Subject: [PATCH 2/6] ASoC: fsl: imx-pcm-rpmsg: set debugfs_prefix via Component driver We can set component->debugfs_prefix via component_driver->debugfs_prefix. Use it. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ik81k5w2.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/fsl/imx-pcm-rpmsg.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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: From 921ee966824b971675927b343394cd1096754487 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:46 +0000 Subject: [PATCH 3/6] ASoC: soc-generic-dmaengine: set debugfs_prefix via Component driver We can set component->debugfs_prefix via component_driver->debugfs_prefix. Use it. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87h5nlk5vx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/soc-generic-dmaengine-pcm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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; From d7c18d15c6d93ffcaaaa0c68c31122293c9d1dde Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:51 +0000 Subject: [PATCH 4/6] ASoC: stm: stm32_adfsdm: set debugfs_prefix via Component driver We can set component->debugfs_prefix via component_driver->debugfs_prefix. Use it. Now it no longer need to use snd_soc_component_initialize() / snd_soc_component_add(). Use snd_soc_component_register() instead. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87fr35k5vs.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/stm/stm32_adfsdm.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) 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__); From 0cac8e35132fe149f555ba6e4f7d92ce69e0cc5c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:56 +0000 Subject: [PATCH 5/6] ASoC: mediatek: mt8173-afe-pcm: set debugfs_prefix via Component driver We can set component->debugfs_prefix via component_driver->debugfs_prefix. Use it. Now it no longer need to use snd_soc_component_initialize() / snd_soc_component_add(). use snd_soc_component_register() instead. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ecipk5vo.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 39 +++------------------- 1 file changed, 4 insertions(+), 35 deletions(-) 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) From cd849a5fcac849a2c9d9391a2676bf3d0b4443dd Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:56:00 +0000 Subject: [PATCH 6/6] ASoC: soc-component: remove .debugfs_prefix from Component All drivers are now setting .debugfs_prefix via Component driver. Remove it from Component. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87cxy9k5vj.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 1 - sound/soc/soc-core.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 337b7ef4156c..11bc9527653f 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -248,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/soc-core.c b/sound/soc/soc-core.c index c0599031a3e4..e8986c039aa5 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); @@ -2842,11 +2842,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);