Re: [alsa-devel] [PATCH] alsa/Au1xxx-PSC: use resource_size
2010/5/28 Wan ZongShun mcuos.com@gmail.com:
Dear Manuel & Mark,
I make a little modification to use the 'resource_size'.
It's okay with me. You could also modifiy psc-ac97.c in the same way.
Manuel Lauss
2010/5/28 Manuel Lauss manuel.lauss@googlemail.com:
2010/5/28 Wan ZongShun mcuos.com@gmail.com:
Dear Manuel & Mark,
I make a little modification to use the 'resource_size'.
It's okay with me. You could also modifiy psc-ac97.c in the same way.
Okay, I will merge it you mentioned into my this patch and re-submit to you later.
Thanks!
Manuel Lauss
Dear Manuel & Mark,
Fix it again.
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
From 389d787f06d2ac0b4c8cac2705385295b0d7c112 Mon Sep 17 00:00:00 2001 From: zswan <zswan@zswan-marvell.(none)> Date: Fri, 28 May 2010 13:39:12 +0800 Subject: [PATCH 4/4] -fix-some-issues-of-aux01 v1
--- sound/soc/au1x/psc-ac97.c | 13 ++++++------- sound/soc/au1x/psc-i2s.c | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2..55e1d15 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -375,12 +375,12 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, - "au1xpsc_ac97"); + wd->ioarea = request_mem_region(r->start, resource_size(r), + pdev->name); if (!wd->ioarea) goto out0;
- wd->mmio = ioremap(r->start, 0xffff); + wd->mmio = ioremap(r->start, resource_size(r)); if (!wd->mmio) goto out1;
@@ -410,8 +410,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
snd_soc_unregister_dai(&au1xpsc_ac97_dai); out1: - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(r->start, resource_size(r)); out0: kfree(wd); return ret; @@ -420,6 +419,7 @@ out0: static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); + struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (wd->dmapd) au1xpsc_pcm_destroy(wd->dmapd); @@ -433,8 +433,7 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) au_sync();
iounmap(wd->mmio); - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(r->start, resource_size(r)); kfree(wd);
au1xpsc_ac97_workdata = NULL; /* MDEV */ diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e..d529283 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -321,12 +321,12 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, - "au1xpsc_i2s"); + wd->ioarea = request_mem_region(r->start, resource_size(r), + pdev->name); if (!wd->ioarea) goto out0;
- wd->mmio = ioremap(r->start, 0xffff); + wd->mmio = ioremap(r->start, resource_size(r)); if (!wd->mmio) goto out1;
@@ -362,8 +362,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev)
snd_soc_unregister_dai(&au1xpsc_i2s_dai); out1: - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(r->start, resource_size(r)); out0: kfree(wd); return ret; @@ -372,6 +371,7 @@ out0: static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); + struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (wd->dmapd) au1xpsc_pcm_destroy(wd->dmapd); @@ -384,7 +384,7 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) au_sync();
iounmap(wd->mmio); - release_resource(wd->ioarea); + release_mem_region(r->start, resource_size(r)); kfree(wd->ioarea); kfree(wd);
On Fri, May 28, 2010 at 7:44 AM, Wan ZongShun mcuos.com@gmail.com wrote:
Dear Manuel & Mark,
Fix it again.
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
From 389d787f06d2ac0b4c8cac2705385295b0d7c112 Mon Sep 17 00:00:00 2001 From: zswan <zswan@zswan-marvell.(none)> Date: Fri, 28 May 2010 13:39:12 +0800 Subject: [PATCH 4/4] -fix-some-issues-of-aux01 v1
Please write a proper log entry.
--- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c
[snip]
@@ -372,6 +371,7 @@ out0: static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
- struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (wd->dmapd) au1xpsc_pcm_destroy(wd->dmapd); @@ -384,7 +384,7 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) au_sync();
iounmap(wd->mmio);
- release_resource(wd->ioarea);
- release_mem_region(r->start, resource_size(r));
kfree(wd->ioarea);
This kfree() needs to go too. (Sidenote: I wrote the code this way to avoid the platform_get_resource() you inserted above).
kfree(wd);
I'll run it on real hardware just to be sure.
Manuel
Dear Manuel,
For insteading of using the 'platform_get_resource' in remove function, I think it better to put 'struct resource *r' into 'wd' structure.
I have re-organized the patch and submit to you.
Of course, I must get your approval if I do above. :)
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
--- sound/soc/au1x/psc-ac97.c | 17 ++++++----------- sound/soc/au1x/psc-i2s.c | 17 ++++++----------- sound/soc/au1x/psc.h | 2 +- 3 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2..6bd7376 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -355,7 +355,6 @@ EXPORT_SYMBOL_GPL(au1xpsc_ac97_dai); static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) { int ret; - struct resource *r; unsigned long sel; struct au1xpsc_audio_data *wd;
@@ -368,19 +367,17 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
mutex_init(&wd->lock);
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { + wd->r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!wd->r) { ret = -ENODEV; goto out0; }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, - "au1xpsc_ac97"); - if (!wd->ioarea) + if (!request_mem_region(wd->r->start, resource_size(wd->r), pdev->name)) goto out0;
- wd->mmio = ioremap(r->start, 0xffff); + wd->mmio = ioremap(wd->r->start, resource_size(wd->r)); if (!wd->mmio) goto out1;
@@ -410,8 +407,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
snd_soc_unregister_dai(&au1xpsc_ac97_dai); out1: - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(wd->r->start, resource_size(wd->r)); out0: kfree(wd); return ret; @@ -433,8 +429,7 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) au_sync();
iounmap(wd->mmio); - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(wd->r->start, resource_size(wd->r)); kfree(wd);
au1xpsc_ac97_workdata = NULL; /* MDEV */ diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e..9fb3eed 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -302,7 +302,6 @@ EXPORT_SYMBOL(au1xpsc_i2s_dai);
static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) { - struct resource *r; unsigned long sel; int ret; struct au1xpsc_audio_data *wd; @@ -314,19 +313,17 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) if (!wd) return -ENOMEM;
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!r) { + wd->r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!wd->r) { ret = -ENODEV; goto out0; }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, - "au1xpsc_i2s"); - if (!wd->ioarea) + if (!request_mem_region(wd->r->start, resource_size(wd->r), pdev->name)) goto out0;
- wd->mmio = ioremap(r->start, 0xffff); + wd->mmio = ioremap(wd->r->start, resource_size(wd->r)); if (!wd->mmio) goto out1;
@@ -362,8 +359,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev)
snd_soc_unregister_dai(&au1xpsc_i2s_dai); out1: - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(wd->r->start, resource_size(wd->r)); out0: kfree(wd); return ret; @@ -384,8 +380,7 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) au_sync();
iounmap(wd->mmio); - release_resource(wd->ioarea); - kfree(wd->ioarea); + release_mem_region(wd->r->start, resource_size(wd->r)); kfree(wd);
au1xpsc_i2s_workdata = NULL; /* MDEV */ diff --git a/sound/soc/au1x/psc.h b/sound/soc/au1x/psc.h index 32d3807..4680a53 100644 --- a/sound/soc/au1x/psc.h +++ b/sound/soc/au1x/psc.h @@ -32,7 +32,7 @@ struct au1xpsc_audio_data { unsigned long rate;
unsigned long pm[2]; - struct resource *ioarea; + struct resource *r; struct mutex lock; struct platform_device *dmapd; };
On Fri, May 28, 2010 at 8:31 AM, Wan ZongShun mcuos.com@gmail.com wrote:
Dear Manuel,
For insteading of using the 'platform_get_resource' in remove function, I think it better to put 'struct resource *r' into 'wd' structure.
I have re-organized the patch and submit to you.
Of course, I must get your approval if I do above. :)
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
The patch doesn't apply at all to latest linus-git.
How about something much simpler, like this for example:
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2..a18e924 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -375,7 +375,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, + wd->ioarea = request_mem_region(r->start, resource_size(r), "au1xpsc_ac97"); if (!wd->ioarea) goto out0; diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e..76e848f 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -321,7 +321,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, + wd->ioarea = request_mem_region(r->start, resource_size(r), "au1xpsc_i2s"); if (!wd->ioarea) goto out0;
Manuel
2010/5/28 Manuel Lauss manuel.lauss@googlemail.com:
On Fri, May 28, 2010 at 8:31 AM, Wan ZongShun mcuos.com@gmail.com wrote:
Dear Manuel,
For insteading of using the 'platform_get_resource' in remove function, I think it better to put 'struct resource *r' into 'wd' structure.
I have re-organized the patch and submit to you.
Of course, I must get your approval if I do above. :)
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
The patch doesn't apply at all to latest linus-git.
How about something much simpler, like this for example:
Okay, maybe it better, but I just think the 'release_mem_region' and 'request_mem_region' should be paired.
Every things changed are up to you, this patch is not bad to me. :)
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2..a18e924 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -375,7 +375,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) }
ret = -EBUSY;
- wd->ioarea = request_mem_region(r->start, r->end - r->start + 1,
- wd->ioarea = request_mem_region(r->start, resource_size(r),
"au1xpsc_ac97"); if (!wd->ioarea) goto out0; diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e..76e848f 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -321,7 +321,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) }
ret = -EBUSY;
- wd->ioarea = request_mem_region(r->start, r->end - r->start + 1,
- wd->ioarea = request_mem_region(r->start, resource_size(r),
"au1xpsc_i2s"); if (!wd->ioarea) goto out0;
Manuel
Dear Mark & Liam,
alsa Au1xxx-PSC use resource_size.
Manuel has agreed this following version patch, now, can it be merged?
Signed-off-by: Wan ZongShunmcuos.com@gmail.com --- sound/soc/au1x/psc-ac97.c | 2 +- sound/soc/au1x/psc-i2s.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c index a61ccd2..a18e924 100644 --- a/sound/soc/au1x/psc-ac97.c +++ b/sound/soc/au1x/psc-ac97.c @@ -375,7 +375,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, + wd->ioarea = request_mem_region(r->start, resource_size(r), "au1xpsc_ac97"); if (!wd->ioarea) goto out0; diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c index 495be6e..76e848f 100644 --- a/sound/soc/au1x/psc-i2s.c +++ b/sound/soc/au1x/psc-i2s.c @@ -321,7 +321,7 @@ static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) }
ret = -EBUSY; - wd->ioarea = request_mem_region(r->start, r->end - r->start + 1, + wd->ioarea = request_mem_region(r->start, resource_size(r), "au1xpsc_i2s"); if (!wd->ioarea) goto out0;
On Fri, May 28, 2010 at 05:07:40PM +0800, Wan ZongShun wrote:
Dear Mark & Liam,
alsa Au1xxx-PSC use resource_size.
Manuel has agreed this following version patch, now, can it be merged?
This has wordwrap issues and won't apply, please resend. As I said previously please also try to follow Documentation/SubmittingPatches (eg, don't have non-changelog text above the --- in the mail and use a standard prefix for the subject line).
Hi Mark,
Thanks for your comments. Regarding the patch related to Au1xxx-PSC, I will modify the patch and resend it tomorrow, please drop all the previous ones.
2010/5/31 Mark Brown broonie@opensource.wolfsonmicro.com:
On Fri, May 28, 2010 at 05:07:40PM +0800, Wan ZongShun wrote:
Dear Mark & Liam,
alsa Au1xxx-PSC use resource_size.
Manuel has agreed this following version patch, now, can it be merged?
This has wordwrap issues and won't apply, please resend. As I said previously please also try to follow Documentation/SubmittingPatches (eg, don't have non-changelog text above the --- in the mail and use a standard prefix for the subject line).
On Fri, May 28, 2010 at 01:44:24PM +0800, Wan ZongShun wrote:
Dear Manuel & Mark,
Fix it again.
Signed-off-by:Wan ZongShunmcuos.com@gmail.com
From 389d787f06d2ac0b4c8cac2705385295b0d7c112 Mon Sep 17 00:00:00 2001 From: zswan <zswan@zswan-marvell.(none)> Date: Fri, 28 May 2010 13:39:12 +0800 Subject: [PATCH 4/4] -fix-some-issues-of-aux01 v1
This looks a bit mangled, could you please confirm what's going on with this stuff. It would also be very helpful if you could submit patches in the format documented in Documentation/SubmittingPatches.
The patch itself looks OK.
participants (3)
-
Manuel Lauss
-
Mark Brown
-
Wan ZongShun