Skip to contentSkip to conversation

alsa/Au1xxx-PSC: use resource_size

PATCH Manuel Lauss 3 participants 11 messages May 28, 2010 – May 31, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#2 lore raw

2010/5/28 Manuel Lauss <[email protected]>:

Quoted 7 lines

2010/5/28 Wan ZongShun <[email protected]>:

Quoted 3 lines

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!

Quoted 2 lines

      Manuel Lauss

Signature · 14 lines
*linux-arm-kernel mailing list
mail addr:[email protected]
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:[email protected]
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
[email protected]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#3 lore raw

Dear Manuel & Mark,

Fix it again.

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(-)
sound/soc/au1x/psc-ac97.c +0 -0
index a61ccd2..55e1d15 100644
@@ -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 */

sound/soc/au1x/psc-i2s.c +0 -0
index 495be6e..d529283 100644
@@ -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);

Signature · 1 line
1.6.3.3
#4 lore raw
Quoted 10 lines · Wan ZongShun

Dear Manuel & Mark,

Fix it again.

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.

Quoted 2 lines
sound/soc/au1x/psc-i2s.c +0 -0

[snip]

Quoted 9 lines
sound/soc/au1x/psc-i2s.c +1 -0
@@ -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);

sound/soc/au1x/psc-i2s.c static int __devexit au1xpsc_i2s_drvremove(struct · line 389

Quoted 7 lines
sound/soc/au1x/psc-i2s.c +1 -1
@@ -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).

sound/soc/au1x/psc-i2s.c static int __devexit au1xpsc_i2s_drvremove(struct · line 390

Quoted 1 line
sound/soc/au1x/psc-i2s.c +0 -0
        kfree(wd);

I'll run it on real hardware just to be sure.

Manuel

#5 lore raw

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. :)

---
  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(-)
sound/soc/au1x/psc-ac97.c +0 -1
index a61ccd2..6bd7376 100644
@@ -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 */

sound/soc/au1x/psc-i2s.c +0 -1
index 495be6e..9fb3eed 100644
@@ -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 */

sound/soc/au1x/psc.h +1 -1
index 32d3807..4680a53 100644
@@ -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;
  };
Signature · 1 line
1.6.3.3
#6 lore raw
Quoted 10 lines · Wan ZongShun

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. :)

The patch doesn't apply at all to latest linus-git.

How about something much simpler, like this for example:

sound/soc/au1x/psc-ac97.c +0 -0
index a61ccd2..a18e924 100644
@@ -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;
sound/soc/au1x/psc-i2s.c +0 -0
index 495be6e..76e848f 100644
@@ -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

#7 lore raw

2010/5/28 Manuel Lauss <[email protected]>:

Quoted 8 lines · Wan ZongShun
Quoted 7 lines

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.

Quoted 8 lines
Quoted 3 lines

Of course, I must get your approval if I do above. :)

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. :)

Quoted 31 lines
sound/soc/au1x/psc-ac97.c +1 -1
index a61ccd2..a18e924 100644
@@ -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;

sound/soc/au1x/psc-i2s.c +1 -1
index 495be6e..76e848f 100644
@@ -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

Signature · 14 lines
*linux-arm-kernel mailing list
mail addr:[email protected]
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:[email protected]
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
[email protected]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#8 lore raw
In reply to Manuel Lauss

Dear Mark & Liam,

alsa Au1xxx-PSC use resource_size.

Manuel has agreed this following version patch, now, can it be merged?

---
  sound/soc/au1x/psc-ac97.c |    2 +-
  sound/soc/au1x/psc-i2s.c  |    2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/au1x/psc-ac97.c +0 -0
index a61ccd2..a18e924 100644
@@ -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;

sound/soc/au1x/psc-i2s.c +0 -0
index 495be6e..76e848f 100644
@@ -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;

Signature · 1 line
1.6.3.3
#11 lore raw
In reply to Wan ZongShun
Quoted 10 lines · Wan ZongShun

Dear Manuel & Mark,

Fix it again.

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.

#9 lore raw
In reply to Wan ZongShun
Quoted 5 lines · Wan ZongShun

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).

#10 lore raw

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 <[email protected]>:

Quoted 12 lines · Wan ZongShun
Quoted 5 lines

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).

Signature · 14 lines
*linux-arm-kernel mailing list
mail addr:[email protected]
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:[email protected]
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
[email protected]
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel