From: Kuninori Morimoto Date: Tue, 2 Jun 2026 02:55:56 +0000 (+0000) Subject: ASoC: mediatek: mt8173-afe-pcm: set debugfs_prefix via Component driver X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cac8e35132fe149f555ba6e4f7d92ce69e0cc5c;p=thirdparty%2Flinux.git 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 --- 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)