[alsa-devel] [PATCH 1/2] ASoC: fsl: imx-sgtl5000: Use devm_clk_get()

Fabio Estevam festevam at gmail.com
Wed Mar 13 00:51:29 CET 2013


From: Fabio Estevam <fabio.estevam at freescale.com>

Using devm_clk_get() can make the code smaller and simpler.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
 sound/soc/fsl/imx-sgtl5000.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 424347e..74a4628 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -128,7 +128,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 		goto fail;
 	}
 
-	data->codec_clk = clk_get(&codec_dev->dev, NULL);
+	data->codec_clk = devm_clk_get(&codec_dev->dev, NULL);
 	if (IS_ERR(data->codec_clk)) {
 		/* assuming clock enabled by default */
 		data->codec_clk = NULL;
@@ -175,7 +175,6 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, data);
 clk_fail:
-	clk_put(data->codec_clk);
 fail:
 	if (ssi_np)
 		of_node_put(ssi_np);
@@ -189,10 +188,9 @@ static int imx_sgtl5000_remove(struct platform_device *pdev)
 {
 	struct imx_sgtl5000_data *data = platform_get_drvdata(pdev);
 
-	if (data->codec_clk) {
+	if (data->codec_clk)
 		clk_disable_unprepare(data->codec_clk);
-		clk_put(data->codec_clk);
-	}
+
 	snd_soc_unregister_card(&data->card);
 
 	return 0;
-- 
1.7.9.5



More information about the Alsa-devel mailing list