From: Wan ZongShun <mcuos.com@gmail.com>
To: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: manuel.lauss@gmail.com, alsa-devel <alsa-devel@alsa-project.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] alsa/Au1xxx-PSC: use resource_size
Date: Fri, 28 May 2010 14:31:23 +0800 [thread overview]
Message-ID: <4BFF633B.7030101@gmail.com> (raw)
In-Reply-To: <AANLkTikn3BHn1D3uVQWO6Xuiv4vkk8pMe96F7uUUSAmM@mail.gmail.com>
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 ZongShun<mcuos.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;
};
--
1.6.3.3
next prev parent reply other threads:[~2010-05-28 6:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4BFF33B3.1040506@gmail.com>
2010-05-28 5:08 ` [PATCH] alsa/Au1xxx-PSC: use resource_size Manuel Lauss
2010-05-28 5:17 ` Wan ZongShun
2010-05-28 5:44 ` [PATCH v2] " Wan ZongShun
2010-05-28 5:52 ` Manuel Lauss
2010-05-28 6:31 ` Wan ZongShun [this message]
2010-05-28 6:53 ` Manuel Lauss
2010-05-28 7:05 ` Wan ZongShun
2010-05-28 9:07 ` Wan ZongShun
2010-05-31 11:08 ` Mark Brown
2010-05-31 12:36 ` Wan ZongShun
2010-05-31 10:47 ` Mark Brown
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=4BFF633B.7030101@gmail.com \
--to=mcuos.com@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=manuel.lauss@gmail.com \
--cc=manuel.lauss@googlemail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.