Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: stm: stm32_adfsdm: Use devm helpers and drop remove callback
@ 2026-11-26 10:07 phucduc.bui
  0 siblings, 0 replies; only message in thread
From: phucduc.bui @ 2026-11-26 10:07 UTC (permalink / raw)
  To: Mark Brown, Olivier Moysan
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Arnaud Pouliquen,
	Maxime Coquelin, linux-sound, linux-stm32, linux-arm-kernel,
	linux-kernel, Alexandre Torgue, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

The components are registered with devm helpers, but the remove
callback unregisters them explicitly. Use devm_pm_runtime_enable()
and drop the remove callback.

Also get the IIO channels first and register the PCM component
before the DAI component.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

Note: Compile-tested only.

 sound/soc/stm/stm32_adfsdm.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c
index 083dc4c26274..cd54fd071b2b 100644
--- a/sound/soc/stm/stm32_adfsdm.c
+++ b/sound/soc/stm/stm32_adfsdm.c
@@ -336,12 +336,6 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(&pdev->dev, priv);
 
-	ret = devm_snd_soc_register_component(&pdev->dev,
-					      &stm32_adfsdm_dai_component,
-					      &priv->dai_drv, 1);
-	if (ret < 0)
-		return ret;
-
 	/* Associate iio channel */
 	priv->iio_ch  = devm_iio_channel_get_all(&pdev->dev);
 	if (IS_ERR(priv->iio_ch))
@@ -357,19 +351,17 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = snd_soc_register_component(&pdev->dev, &stm32_adfsdm_soc_platform, NULL, 0);
+	ret = devm_pm_runtime_enable(&pdev->dev);
+	if (ret)
+		return ret;
+
+	ret = devm_snd_soc_register_component(&pdev->dev, &stm32_adfsdm_soc_platform, NULL, 0);
 	if (ret < 0)
 		return ret;
 
-	pm_runtime_enable(&pdev->dev);
-
-	return ret;
-}
-
-static void stm32_adfsdm_remove(struct platform_device *pdev)
-{
-	snd_soc_unregister_component(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
+	return devm_snd_soc_register_component(&pdev->dev,
+					       &stm32_adfsdm_dai_component,
+					       &priv->dai_drv, 1);
 }
 
 static struct platform_driver stm32_adfsdm_driver = {
@@ -378,7 +370,6 @@ static struct platform_driver stm32_adfsdm_driver = {
 		   .of_match_table = stm32_adfsdm_of_match,
 		   },
 	.probe = stm32_adfsdm_probe,
-	.remove = stm32_adfsdm_remove,
 };
 
 module_platform_driver(stm32_adfsdm_driver);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-26 10:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 10:07 [PATCH] ASoC: stm: stm32_adfsdm: Use devm helpers and drop remove callback phucduc.bui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox