* [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups
@ 2013-05-08 9:47 Uwe Kleine-König
2013-05-08 10:52 ` Mark Brown
2013-06-12 15:50 ` Lars-Peter Clausen
0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2013-05-08 9:47 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, alsa-devel; +Cc: Vipin Kumar, Rajeev Kumar, kernel
Drop dev_set_drvdata as this is handled in the core and use
devm_request_and_ioremap instead of devm_ioremap to properly register the
address range used
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
sound/soc/spear/spdif_in.c | 17 ++---------------
sound/soc/spear/spdif_out.c | 17 +++--------------
2 files changed, 5 insertions(+), 29 deletions(-)
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index c7c4b20..d40bb34 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -231,7 +231,7 @@ static int spdif_in_probe(struct platform_device *pdev)
if (host->irq < 0)
return -EINVAL;
- host->clk = clk_get(&pdev->dev, NULL);
+ host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk))
return PTR_ERR(host->clk);
@@ -253,33 +253,20 @@ static int spdif_in_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, host->irq, spdif_in_irq, 0,
"spdif-in", host);
if (ret) {
- clk_put(host->clk);
dev_warn(&pdev->dev, "request_irq failed\n");
return ret;
}
- ret = snd_soc_register_dai(&pdev->dev, &spdif_in_dai);
- if (ret != 0) {
- clk_put(host->clk);
- return ret;
- }
-
- return 0;
+ return snd_soc_register_dai(&pdev->dev, &spdif_in_dai);
}
static int spdif_in_remove(struct platform_device *pdev)
{
- struct spdif_in_dev *host = dev_get_drvdata(&pdev->dev);
-
snd_soc_unregister_dai(&pdev->dev);
- dev_set_drvdata(&pdev->dev, NULL);
-
- clk_put(host->clk);
return 0;
}
-
static struct platform_driver spdif_in_driver = {
.probe = spdif_in_probe,
.remove = spdif_in_remove,
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 5eac4cd..b2488b4 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -293,14 +293,14 @@ static int spdif_out_probe(struct platform_device *pdev)
return -ENOMEM;
}
- host->io_base = devm_ioremap(&pdev->dev, res->start,
+ host->io_base = devm_request_and_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!host->io_base) {
dev_warn(&pdev->dev, "ioremap failed\n");
return -ENOMEM;
}
- host->clk = clk_get(&pdev->dev, NULL);
+ host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk))
return PTR_ERR(host->clk);
@@ -314,23 +314,12 @@ static int spdif_out_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, host);
- ret = snd_soc_register_dai(&pdev->dev, &spdif_out_dai);
- if (ret != 0) {
- clk_put(host->clk);
- return ret;
- }
-
- return 0;
+ return snd_soc_register_dai(&pdev->dev, &spdif_out_dai);
}
static int spdif_out_remove(struct platform_device *pdev)
{
- struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
-
snd_soc_unregister_dai(&pdev->dev);
- dev_set_drvdata(&pdev->dev, NULL);
-
- clk_put(host->clk);
return 0;
}
--
1.8.2.rc2
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups
2013-05-08 9:47 [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups Uwe Kleine-König
@ 2013-05-08 10:52 ` Mark Brown
2013-06-12 15:50 ` Lars-Peter Clausen
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-05-08 10:52 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Vipin Kumar, alsa-devel, Rajeev Kumar, Liam Girdwood, kernel
[-- Attachment #1.1: Type: text/plain, Size: 249 bytes --]
On Wed, May 08, 2013 at 11:47:38AM +0200, Uwe Kleine-König wrote:
> Drop dev_set_drvdata as this is handled in the core and use
> devm_request_and_ioremap instead of devm_ioremap to properly register the
> address range used
Applied, thanks.
[-- 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] 5+ messages in thread
* Re: [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups
2013-05-08 9:47 [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups Uwe Kleine-König
2013-05-08 10:52 ` Mark Brown
@ 2013-06-12 15:50 ` Lars-Peter Clausen
2013-06-12 20:18 ` [PATCH] ASoC: SPEAr spdif_{in, out}: fix fallout of previous cleanup Uwe Kleine-König
1 sibling, 1 reply; 5+ messages in thread
From: Lars-Peter Clausen @ 2013-06-12 15:50 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: alsa-devel, Rajeev Kumar, Liam Girdwood, Vipin Kumar, Mark Brown,
kernel
On 05/08/2013 11:47 AM, Uwe Kleine-König wrote:
> Drop dev_set_drvdata as this is handled in the core and use
> devm_request_and_ioremap instead of devm_ioremap to properly register the
> address range used
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Btw, the patch added a couple of warnings and one build error:
sound/soc/spear/spdif_in.c: In function 'spdif_in_remove':
sound/soc/spear/spdif_in.c:272:23: warning: unused variable 'host'
CC sound/soc/spear/spdif_out.o
sound/soc/spear/spdif_out.c: In function 'spdif_out_probe':
sound/soc/spear/spdif_out.c:302:5: warning: passing argument 2 of
'devm_request_and_ioremap' makes pointer from integer without a cast
include/linux/device.h:576:15: note: expected 'struct resource *' but
argument is of type 'resource_size_t'
sound/soc/spear/spdif_out.c:302:5: error: too many arguments to function
'devm_request_and_ioremap'
include/linux/device.h:576:15: note: declared here
sound/soc/spear/spdif_out.c: In function 'spdif_out_remove':
> ---
> sound/soc/spear/spdif_in.c | 17 ++---------------
> sound/soc/spear/spdif_out.c | 17 +++--------------
> 2 files changed, 5 insertions(+), 29 deletions(-)
>
> diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
> index c7c4b20..d40bb34 100644
> --- a/sound/soc/spear/spdif_in.c
> +++ b/sound/soc/spear/spdif_in.c
> @@ -231,7 +231,7 @@ static int spdif_in_probe(struct platform_device *pdev)
> if (host->irq < 0)
> return -EINVAL;
>
> - host->clk = clk_get(&pdev->dev, NULL);
> + host->clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(host->clk))
> return PTR_ERR(host->clk);
>
> @@ -253,33 +253,20 @@ static int spdif_in_probe(struct platform_device *pdev)
> ret = devm_request_irq(&pdev->dev, host->irq, spdif_in_irq, 0,
> "spdif-in", host);
> if (ret) {
> - clk_put(host->clk);
> dev_warn(&pdev->dev, "request_irq failed\n");
> return ret;
> }
>
> - ret = snd_soc_register_dai(&pdev->dev, &spdif_in_dai);
> - if (ret != 0) {
> - clk_put(host->clk);
> - return ret;
> - }
> -
> - return 0;
> + return snd_soc_register_dai(&pdev->dev, &spdif_in_dai);
> }
>
> static int spdif_in_remove(struct platform_device *pdev)
> {
> - struct spdif_in_dev *host = dev_get_drvdata(&pdev->dev);
> -
> snd_soc_unregister_dai(&pdev->dev);
> - dev_set_drvdata(&pdev->dev, NULL);
> -
> - clk_put(host->clk);
>
> return 0;
> }
>
> -
> static struct platform_driver spdif_in_driver = {
> .probe = spdif_in_probe,
> .remove = spdif_in_remove,
> diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
> index 5eac4cd..b2488b4 100644
> --- a/sound/soc/spear/spdif_out.c
> +++ b/sound/soc/spear/spdif_out.c
> @@ -293,14 +293,14 @@ static int spdif_out_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> - host->io_base = devm_ioremap(&pdev->dev, res->start,
> + host->io_base = devm_request_and_ioremap(&pdev->dev, res->start,
> resource_size(res));
> if (!host->io_base) {
> dev_warn(&pdev->dev, "ioremap failed\n");
> return -ENOMEM;
> }
>
> - host->clk = clk_get(&pdev->dev, NULL);
> + host->clk = devm_clk_get(&pdev->dev, NULL);
> if (IS_ERR(host->clk))
> return PTR_ERR(host->clk);
>
> @@ -314,23 +314,12 @@ static int spdif_out_probe(struct platform_device *pdev)
>
> dev_set_drvdata(&pdev->dev, host);
>
> - ret = snd_soc_register_dai(&pdev->dev, &spdif_out_dai);
> - if (ret != 0) {
> - clk_put(host->clk);
> - return ret;
> - }
> -
> - return 0;
> + return snd_soc_register_dai(&pdev->dev, &spdif_out_dai);
> }
>
> static int spdif_out_remove(struct platform_device *pdev)
> {
> - struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
> -
> snd_soc_unregister_dai(&pdev->dev);
> - dev_set_drvdata(&pdev->dev, NULL);
> -
> - clk_put(host->clk);
>
> return 0;
> }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ASoC: SPEAr spdif_{in, out}: fix fallout of previous cleanup
2013-06-12 15:50 ` Lars-Peter Clausen
@ 2013-06-12 20:18 ` Uwe Kleine-König
2013-06-13 9:26 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2013-06-12 20:18 UTC (permalink / raw)
To: Lars-Peter Clausen, Mark Brown
Cc: Vipin Kumar, alsa-devel, Rajeev Kumar, Liam Girdwood, kernel
The patch that resulted in
bfcc74e (ASoC: SPEAr spdif_{in,out}: use devm for clk and a few
more cleanups)
was broken and applied on a newer tree than it was created for. So
bfcc74e introduced unbalanced clk handling, two warnings about unused
variables and passed 3 arguments to a function only taking 2. This
commit fixes that.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
sound/soc/spear/spdif_in.c | 10 +---------
sound/soc/spear/spdif_out.c | 12 ++----------
2 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index f0071dd..63acfeb 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -257,20 +257,12 @@ static int spdif_in_probe(struct platform_device *pdev)
return ret;
}
- ret = snd_soc_register_component(&pdev->dev, &spdif_in_component,
+ return snd_soc_register_component(&pdev->dev, &spdif_in_component,
&spdif_in_dai, 1);
- if (ret != 0) {
- clk_put(host->clk);
- return ret;
- }
-
- return 0;
}
static int spdif_in_remove(struct platform_device *pdev)
{
- struct spdif_in_dev *host = dev_get_drvdata(&pdev->dev);
-
snd_soc_unregister_component(&pdev->dev);
return 0;
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 4bde512..a4a8748 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -298,8 +298,7 @@ static int spdif_out_probe(struct platform_device *pdev)
return -ENOMEM;
}
- host->io_base = devm_request_and_ioremap(&pdev->dev, res->start,
- resource_size(res));
+ host->io_base = devm_request_and_ioremap(&pdev->dev, res);
if (!host->io_base) {
dev_warn(&pdev->dev, "ioremap failed\n");
return -ENOMEM;
@@ -321,18 +320,11 @@ static int spdif_out_probe(struct platform_device *pdev)
ret = snd_soc_register_component(&pdev->dev, &spdif_out_component,
&spdif_out_dai, 1);
- if (ret != 0) {
- clk_put(host->clk);
- return ret;
- }
-
- return 0;
+ return ret;
}
static int spdif_out_remove(struct platform_device *pdev)
{
- struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
-
snd_soc_unregister_component(&pdev->dev);
return 0;
--
1.8.2.rc2
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: SPEAr spdif_{in, out}: fix fallout of previous cleanup
2013-06-12 20:18 ` [PATCH] ASoC: SPEAr spdif_{in, out}: fix fallout of previous cleanup Uwe Kleine-König
@ 2013-06-13 9:26 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-06-13 9:26 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: alsa-devel, Lars-Peter Clausen, Liam Girdwood, Vipin Kumar,
Rajeev Kumar, kernel
[-- Attachment #1.1: Type: text/plain, Size: 207 bytes --]
On Wed, Jun 12, 2013 at 10:18:01PM +0200, Uwe Kleine-König wrote:
> The patch that resulted in
>
> bfcc74e (ASoC: SPEAr spdif_{in,out}: use devm for clk and a few
> more cleanups)
Applied, thanks.
[-- 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] 5+ messages in thread
end of thread, other threads:[~2013-06-13 9:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 9:47 [PATCH] ASoC: SPEAr spdif_{in, out}: use devm for clk and a few more cleanups Uwe Kleine-König
2013-05-08 10:52 ` Mark Brown
2013-06-12 15:50 ` Lars-Peter Clausen
2013-06-12 20:18 ` [PATCH] ASoC: SPEAr spdif_{in, out}: fix fallout of previous cleanup Uwe Kleine-König
2013-06-13 9:26 ` 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).