Skip to contentSkip to conversation

ASoC: stm: stm32_adfsdm: Use devm helpers and drop remove callback

PATCH New [email protected] 1 participant 1 message Nov 26

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: stm: stm32_adfsdm: Use devm helpers and drop remove callback

From: bui duc phuc <[email protected]>

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.

---

Note: Compile-tested only.

 sound/soc/stm/stm32_adfsdm.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)
sound/soc/stm/stm32_adfsdm.c +8 -17
index 083dc4c26274..cd54fd071b2b 100644
@@ -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);
Signature · 1 line
2.43.0