[alsa-devel] [PATCH 4/4] ASoC: imx-sgtl5000: Convert to devm_clk_get()

Fabio Estevam festevam at gmail.com
Thu Apr 18 01:55:21 CEST 2013


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

Converting to devm_clk_get() can simplify the code a bit.

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

diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 18af815..c869996 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -137,7 +137,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)) {
 		ret = PTR_ERR(data->codec_clk);
 		dev_err(&codec_dev->dev, "could not get codec clk: %d\n", ret);
@@ -186,7 +186,6 @@ static int imx_sgtl5000_probe(struct platform_device *pdev)
 
 clk_fail:
 	clk_disable_unprepare(data->codec_clk);
-	clk_put(data->codec_clk);
 fail:
 	if (ssi_np)
 		of_node_put(ssi_np);
@@ -200,10 +199,7 @@ static int imx_sgtl5000_remove(struct platform_device *pdev)
 {
 	struct imx_sgtl5000_data *data = platform_get_drvdata(pdev);
 
-	if (data->codec_clk) {
-		clk_disable_unprepare(data->codec_clk);
-		clk_put(data->codec_clk);
-	}
+	clk_disable_unprepare(data->codec_clk);
 	snd_soc_unregister_card(&data->card);
 
 	return 0;
-- 
1.7.9.5



More information about the Alsa-devel mailing list