From: Shawn Guo <shawn.guo@linaro.org>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
linux-arm-kernel@lists.infradead.org,
Dong Aisheng <dong.aisheng@linaro.org>,
Shawn Guo <shawn.guo@linaro.org>
Subject: [PATCH 2/6] ASoC: mxs: use devm_clk_get for mxs_saif_probe
Date: Thu, 10 May 2012 16:42:09 +0800 [thread overview]
Message-ID: <1336639333-11561-3-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1336639333-11561-1-git-send-email-shawn.guo@linaro.org>
Use devm_clk_get for mxs_saif_probe to ease the cleanup.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
sound/soc/mxs/mxs-saif.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 40d0775..5192db6 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -658,7 +658,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
return ret;
}
- saif->clk = clk_get(&pdev->dev, NULL);
+ saif->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(saif->clk)) {
ret = PTR_ERR(saif->clk);
dev_err(&pdev->dev, "Cannot get the clock: %d\n",
@@ -671,25 +671,22 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
saif->base = devm_request_and_ioremap(&pdev->dev, iores);
if (!saif->base) {
dev_err(&pdev->dev, "ioremap failed\n");
- ret = -ENODEV;
- goto failed_get_resource;
+ return -ENODEV;
}
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmares) {
- ret = -ENODEV;
dev_err(&pdev->dev, "failed to get dma resource: %d\n",
ret);
- goto failed_get_resource;
+ return -ENODEV;
}
saif->dma_param.chan_num = dmares->start;
saif->irq = platform_get_irq(pdev, 0);
if (saif->irq < 0) {
- ret = saif->irq;
dev_err(&pdev->dev, "failed to get irq resource: %d\n",
ret);
- goto failed_get_resource;
+ return saif->irq;
}
saif->dev = &pdev->dev;
@@ -697,7 +694,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
"mxs-saif", saif);
if (ret) {
dev_err(&pdev->dev, "failed to request irq\n");
- goto failed_get_resource;
+ return ret;
}
saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
@@ -705,7 +702,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
ret = saif->dma_param.chan_irq;
dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
ret);
- goto failed_get_resource;
+ return saif->dma_param.chan_irq;
}
platform_set_drvdata(pdev, saif);
@@ -713,7 +710,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai);
if (ret) {
dev_err(&pdev->dev, "register DAI failed\n");
- goto failed_get_resource;
+ return ret;
}
saif->soc_platform_pdev = platform_device_alloc(
@@ -736,8 +733,6 @@ failed_pdev_add:
platform_device_put(saif->soc_platform_pdev);
failed_pdev_alloc:
snd_soc_unregister_dai(&pdev->dev);
-failed_get_resource:
- clk_put(saif->clk);
return ret;
}
@@ -748,7 +743,6 @@ static int __devexit mxs_saif_remove(struct platform_device *pdev)
platform_device_unregister(saif->soc_platform_pdev);
snd_soc_unregister_dai(&pdev->dev);
- clk_put(saif->clk);
return 0;
}
--
1.7.5.4
next prev parent reply other threads:[~2012-05-10 8:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 8:42 [PATCH 0/6] Add device tree support for mxs audio Shawn Guo
2012-05-10 8:42 ` [PATCH 1/6] ASoC: mxs: add __devinit for mxs_saif_probe Shawn Guo
2012-05-10 8:58 ` Dong Aisheng
2012-05-10 9:32 ` Mark Brown
2012-05-10 8:42 ` Shawn Guo [this message]
2012-05-10 9:12 ` [PATCH 2/6] ASoC: mxs: use devm_clk_get " Dong Aisheng
2012-05-10 9:11 ` Shawn Guo
2012-05-10 9:13 ` Mark Brown
2012-05-10 9:17 ` Shawn Guo
2012-05-10 9:30 ` Mark Brown
2012-05-10 12:01 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 3/6] ASoC: mxs: mxs-pcm does not need to be a plaform_driver Shawn Guo
2012-05-10 9:25 ` Dong Aisheng
2012-05-10 12:13 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 4/6] ASoC: mxs: add device tree support for mxs-saif Shawn Guo
2012-05-10 9:45 ` Dong Aisheng
2012-05-10 12:14 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 5/6] ASoC: mxs: add device tree support for mxs-sgtl5000 Shawn Guo
2012-05-10 11:16 ` Dong Aisheng
2012-05-10 12:20 ` Shawn Guo
2012-05-11 2:33 ` Dong Aisheng
2012-05-11 2:49 ` Shawn Guo
2012-05-11 14:14 ` Shawn Guo
2012-05-10 8:42 ` [PATCH 6/6] ARM: dts: enable audio support for imx28-evk Shawn Guo
2012-05-10 11:22 ` Dong Aisheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336639333-11561-3-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dong.aisheng@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).