* SM501: Fix missing uses of resource_size()
@ 2009-11-10 17:17 Ben Dooks
2009-11-10 17:36 ` Thiago Farina
2009-11-10 18:15 ` Andres Salomon
0 siblings, 2 replies; 5+ messages in thread
From: Ben Dooks @ 2009-11-10 17:17 UTC (permalink / raw)
To: akpm, krzysztof.h1; +Cc: lethal, dilinger, linux-kernel, Simtec Linux Team
[-- Attachment #1: simtec/ready/sm501-use-resource-size.patch --]
[-- Type: text/plain, Size: 2075 bytes --]
There are several places in the SM501 fb driver that could do with using
resource_size() to calculate the size of a resource.
Also fix a bug where request_mem_region() is being passed one too few
bytes when requesting the register memory region, which was causing
the following in /proc/iomem:
13e80000-13e8ffff : sm501-fb.0
13e80000-13e8fffe : sm501-fb
fixed, this reads:
13e80000-13e8ffff : sm501-fb.0
13e80000-13e8ffff : sm501-fb
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
---
drivers/video/sm501fb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: b/drivers/video/sm501fb.c
===================================================================
--- a/drivers/video/sm501fb.c 2009-11-03 11:17:52.000000000 +0000
+++ b/drivers/video/sm501fb.c 2009-11-03 11:18:36.000000000 +0000
@@ -1338,7 +1338,7 @@ static int sm501fb_start(struct sm501fb_
}
info->regs_res = request_mem_region(res->start,
- res->end - res->start,
+ resource_size(res),
pdev->name);
if (info->regs_res == NULL) {
@@ -1347,7 +1347,7 @@ static int sm501fb_start(struct sm501fb_
goto err_release;
}
- info->regs = ioremap(res->start, (res->end - res->start)+1);
+ info->regs = ioremap(res->start, resource_size(res));
if (info->regs == NULL) {
dev_err(dev, "cannot remap registers\n");
ret = -ENXIO;
@@ -1363,7 +1363,7 @@ static int sm501fb_start(struct sm501fb_
}
info->fbmem_res = request_mem_region(res->start,
- (res->end - res->start)+1,
+ resource_size(res),
pdev->name);
if (info->fbmem_res == NULL) {
dev_err(dev, "cannot claim framebuffer\n");
@@ -1377,7 +1377,7 @@ static int sm501fb_start(struct sm501fb_
goto err_mem_res;
}
- info->fbmem_len = (res->end - res->start)+1;
+ info->fbmem_len = resource_size(res);
/* clear framebuffer memory - avoids garbage data on unused fb */
memset(info->fbmem, 0, info->fbmem_len);
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SM501: Fix missing uses of resource_size()
2009-11-10 17:17 SM501: Fix missing uses of resource_size() Ben Dooks
@ 2009-11-10 17:36 ` Thiago Farina
2009-11-10 23:11 ` Ben Dooks
2009-11-10 18:15 ` Andres Salomon
1 sibling, 1 reply; 5+ messages in thread
From: Thiago Farina @ 2009-11-10 17:36 UTC (permalink / raw)
To: Ben Dooks
Cc: akpm, krzysztof.h1, lethal, dilinger, linux-kernel,
Simtec Linux Team
Could you attach the patch as a plain text in the body of email and
[PATCH] at the subject line?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SM501: Fix missing uses of resource_size()
2009-11-10 17:17 SM501: Fix missing uses of resource_size() Ben Dooks
2009-11-10 17:36 ` Thiago Farina
@ 2009-11-10 18:15 ` Andres Salomon
2009-11-10 23:12 ` Ben Dooks
1 sibling, 1 reply; 5+ messages in thread
From: Andres Salomon @ 2009-11-10 18:15 UTC (permalink / raw)
To: linux-kernel
Cc: Vincent Sanders, Simtec Linux Team, akpm, krzysztof.h1, lethal
On Tue, 10 Nov 2009 17:17:34 +0000
Ben Dooks <ben@simtec.co.uk> wrote:
> There are several places in the SM501 fb driver that could do with
> using resource_size() to calculate the size of a resource.
>
Yes, please! Also, as Thiago suggested, please submit this inline.
[...]
> @@ -1363,7 +1363,7 @@ static int sm501fb_start(struct sm501fb_
> }
>
> info->fbmem_res = request_mem_region(res->start,
> - (res->end -
> res->start)+1,
> + resource_size(res),
> pdev->name);
> if (info->fbmem_res == NULL) {
> dev_err(dev, "cannot claim framebuffer\n");
> @@ -1377,7 +1377,7 @@ static int sm501fb_start(struct sm501fb_
Looks like you missed one here; the ioremap on line 1374 should also
use resource_size.
> goto err_mem_res;
> }
>
> - info->fbmem_len = (res->end - res->start)+1;
> + info->fbmem_len = resource_size(res);
>
> /* clear framebuffer memory - avoids garbage data on unused
> fb */ memset(info->fbmem, 0, info->fbmem_len);
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SM501: Fix missing uses of resource_size()
2009-11-10 18:15 ` Andres Salomon
@ 2009-11-10 23:12 ` Ben Dooks
0 siblings, 0 replies; 5+ messages in thread
From: Ben Dooks @ 2009-11-10 23:12 UTC (permalink / raw)
To: Andres Salomon
Cc: linux-kernel, Vincent Sanders, Simtec Linux Team, akpm,
krzysztof.h1, lethal
On Tue, Nov 10, 2009 at 01:15:36PM -0500, Andres Salomon wrote:
> On Tue, 10 Nov 2009 17:17:34 +0000
> Ben Dooks <ben@simtec.co.uk> wrote:
>
> > There are several places in the SM501 fb driver that could do with
> > using resource_size() to calculate the size of a resource.
> >
>
> Yes, please! Also, as Thiago suggested, please submit this inline.
My mailer shows it in line. using quilt mail to send, and it says
that the content has been inlined.
> [...]
> > @@ -1363,7 +1363,7 @@ static int sm501fb_start(struct sm501fb_
> > }
> >
> > info->fbmem_res = request_mem_region(res->start,
> > - (res->end -
> > res->start)+1,
> > + resource_size(res),
> > pdev->name);
> > if (info->fbmem_res == NULL) {
> > dev_err(dev, "cannot claim framebuffer\n");
> > @@ -1377,7 +1377,7 @@ static int sm501fb_start(struct sm501fb_
>
> Looks like you missed one here; the ioremap on line 1374 should also
> use resource_size.
thanks, fixed.
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-10 23:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 17:17 SM501: Fix missing uses of resource_size() Ben Dooks
2009-11-10 17:36 ` Thiago Farina
2009-11-10 23:11 ` Ben Dooks
2009-11-10 18:15 ` Andres Salomon
2009-11-10 23:12 ` Ben Dooks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox