* [PATCH] ASoC: mxs-saif: Use devm_clk_get()
@ 2012-04-26 4:33 Fabio Estevam
2012-04-26 9:25 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2012-04-26 4:33 UTC (permalink / raw)
To: alsa-devel; +Cc: Fabio Estevam, broonie, Fabio Estevam
Using devm_clk_get() can make the error handling path easier.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
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 53f4fd8..bfc1f9e 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -650,7 +650,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
saif->master_id = saif->id;
}
- 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",
@@ -663,16 +663,14 @@ static int 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;
@@ -681,7 +679,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
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;
@@ -689,15 +687,14 @@ static int 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);
if (saif->dma_param.chan_irq < 0) {
- 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);
@@ -705,7 +702,7 @@ static int 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(
@@ -728,8 +725,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;
}
@@ -740,7 +735,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.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mxs-saif: Use devm_clk_get()
2012-04-26 4:33 [PATCH] ASoC: mxs-saif: Use devm_clk_get() Fabio Estevam
@ 2012-04-26 9:25 ` Mark Brown
2012-04-26 11:35 ` Fabio Estevam
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2012-04-26 9:25 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 336 bytes --]
On Thu, Apr 26, 2012 at 01:33:22AM -0300, Fabio Estevam wrote:
> Using devm_clk_get() can make the error handling path easier.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
This is fine but devm_clk_get() is only in Russell's tree so it'll need
to wait for after the merge window - can you please resend then?
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mxs-saif: Use devm_clk_get()
2012-04-26 9:25 ` Mark Brown
@ 2012-04-26 11:35 ` Fabio Estevam
2012-04-26 11:43 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2012-04-26 11:35 UTC (permalink / raw)
To: Mark Brown; +Cc: Fabio Estevam, alsa-devel
On Thu, Apr 26, 2012 at 6:25 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> This is fine but devm_clk_get() is only in Russell's tree so it'll need
> to wait for after the merge window - can you please resend then?
devm_clk_get() is in linux-next. Isn't this ok?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ASoC: mxs-saif: Use devm_clk_get()
2012-04-26 11:35 ` Fabio Estevam
@ 2012-04-26 11:43 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-04-26 11:43 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel
[-- Attachment #1.1: Type: text/plain, Size: 432 bytes --]
On Thu, Apr 26, 2012 at 08:35:03AM -0300, Fabio Estevam wrote:
> On Thu, Apr 26, 2012 at 6:25 AM, Mark Brown
> > This is fine but devm_clk_get() is only in Russell's tree so it'll need
> > to wait for after the merge window - can you please resend then?
> devm_clk_get() is in linux-next. Isn't this ok?
No. If I apply it to for-3.5 then for-3.5 won't build. It needs to be
merged into the branch where the patch gets applied.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] ASoC: mxs-saif: Use devm_clk_get()
@ 2012-08-07 4:29 Fabio Estevam
2012-08-07 14:11 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2012-08-07 4:29 UTC (permalink / raw)
To: broonie; +Cc: Fabio Estevam, alsa-devel
From: Fabio Estevam <fabio.estevam@freescale.com>
Using devm_clk_get can make the code simpler and smaller.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
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 b303071..aa037b2 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -704,7 +704,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",
@@ -717,8 +717,7 @@ 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);
@@ -731,7 +730,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
&saif->dma_param.chan_num);
if (ret) {
dev_err(&pdev->dev, "failed to get dma channel\n");
- goto failed_get_resource;
+ return ret;
}
} else {
saif->dma_param.chan_num = dmares->start;
@@ -742,7 +741,7 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
ret = saif->irq;
dev_err(&pdev->dev, "failed to get irq resource: %d\n",
ret);
- goto failed_get_resource;
+ return ret;
}
saif->dev = &pdev->dev;
@@ -750,7 +749,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);
@@ -758,7 +757,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 ret;
}
platform_set_drvdata(pdev, saif);
@@ -766,7 +765,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;
}
ret = mxs_pcm_platform_register(&pdev->dev);
@@ -779,19 +778,14 @@ static int __devinit mxs_saif_probe(struct platform_device *pdev)
failed_pdev_alloc:
snd_soc_unregister_dai(&pdev->dev);
-failed_get_resource:
- clk_put(saif->clk);
return ret;
}
static int __devexit mxs_saif_remove(struct platform_device *pdev)
{
- struct mxs_saif *saif = platform_get_drvdata(pdev);
-
mxs_pcm_platform_unregister(&pdev->dev);
snd_soc_unregister_dai(&pdev->dev);
- clk_put(saif->clk);
return 0;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-07 17:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-26 4:33 [PATCH] ASoC: mxs-saif: Use devm_clk_get() Fabio Estevam
2012-04-26 9:25 ` Mark Brown
2012-04-26 11:35 ` Fabio Estevam
2012-04-26 11:43 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-08-07 4:29 Fabio Estevam
2012-08-07 14:11 ` Mark Brown
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).