[alsa-devel] [PATCH 09/16] ASoC: fsl: use devm_snd_soc_register_component()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Sep 7 03:02:24 CEST 2018


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Now we have devm_snd_soc_register_component().
Let's use it instead of snd_soc_register_component().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/fsl/imx-ssi.c          | 8 ++------
 sound/soc/fsl/mpc5200_psc_ac97.c | 3 +--
 sound/soc/fsl/mpc5200_psc_i2s.c  | 3 +--
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 0679061..e687c4f 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -593,7 +593,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
 		goto failed_register;
 	}
 
-	ret = snd_soc_register_component(&pdev->dev, &imx_component,
+	ret = devm_snd_soc_register_component(&pdev->dev, &imx_component,
 					 dai, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "register DAI failed\n");
@@ -610,13 +610,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
 
 	if (ssi->fiq_init && ssi->dma_init) {
 		ret = ssi->fiq_init;
-		goto failed_pcm;
+		goto failed_register;
 	}
 
 	return 0;
 
-failed_pcm:
-	snd_soc_unregister_component(&pdev->dev);
 failed_register:
 	clk_disable_unprepare(ssi->clk);
 failed_clk:
@@ -632,8 +630,6 @@ static int imx_ssi_remove(struct platform_device *pdev)
 	if (!ssi->fiq_init)
 		imx_pcm_fiq_exit(pdev);
 
-	snd_soc_unregister_component(&pdev->dev);
-
 	if (ssi->flags & IMX_SSI_USE_AC97)
 		ac97_ssi = NULL;
 
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 07ee355..253494e 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -294,7 +294,7 @@ static int psc_ac97_of_probe(struct platform_device *op)
 		return rc;
 	}
 
-	rc = snd_soc_register_component(&op->dev, &psc_ac97_component,
+	rc = devm_snd_soc_register_component(&op->dev, &psc_ac97_component,
 					psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai));
 	if (rc != 0) {
 		dev_err(&op->dev, "Failed to register DAI\n");
@@ -320,7 +320,6 @@ static int psc_ac97_of_probe(struct platform_device *op)
 static int psc_ac97_of_remove(struct platform_device *op)
 {
 	mpc5200_audio_dma_destroy(op);
-	snd_soc_unregister_component(&op->dev);
 	snd_soc_set_ac97_ops(NULL);
 	return 0;
 }
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index d823294..f789d10 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -166,7 +166,7 @@ static int psc_i2s_of_probe(struct platform_device *op)
 	if (rc != 0)
 		return rc;
 
-	rc = snd_soc_register_component(&op->dev, &psc_i2s_component,
+	rc = devm_snd_soc_register_component(&op->dev, &psc_i2s_component,
 					psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai));
 	if (rc != 0) {
 		pr_err("Failed to register DAI\n");
@@ -212,7 +212,6 @@ static int psc_i2s_of_probe(struct platform_device *op)
 static int psc_i2s_of_remove(struct platform_device *op)
 {
 	mpc5200_audio_dma_destroy(op);
-	snd_soc_unregister_component(&op->dev);
 	return 0;
 }
 
-- 
2.7.4



More information about the Alsa-devel mailing list