Patchwork drivers/mtd/nand/gpio.c: use resource_size()

login
register
mail settings
Submitter hartleys
Date Dec. 14, 2009, 9:30 p.m.
Message ID <BD79186B4FD85F4B8E60E381CAEE19090200EA54@mi8nycmail19.Mi8.com>
Download mbox | patch
Permalink /patch/41146/
State New
Headers show

Comments

hartleys - Dec. 14, 2009, 9:30 p.m.
Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Woodhouse <dwmw2@infradead.org>

---
David Woodhouse - Dec. 31, 2009, 8:54 p.m.
On Mon, 2009-12-14 at 16:30 -0500, H Hartley Sweeten wrote:
> 
> -       release_mem_region(res0->start, res0->end - res0->start + 1);
> +       release_mem_region(res0->start, resouce_size(res0)); 

That's not going to compile. I fixed it up.

Every patch in this batch failed to apply cleanly with git-am, too --
there was something odd about the whitespace at the end of each one.
hartleys - Jan. 5, 2010, 4:09 p.m.
On Thursday, December 31, 2009 1:55 PM, David Woodhouse wrote:
> On Mon, 2009-12-14 at 16:30 -0500, H Hartley Sweeten wrote:
>> 
>> -       release_mem_region(res0->start, res0->end - res0->start + 1);
>> +       release_mem_region(res0->start, resouce_size(res0)); 
>
> That's not going to compile. I fixed it up.

Oops.. Sorry about that. Thanks for fixing.

> Every patch in this batch failed to apply cleanly with git-am, too --
> there was something odd about the whitespace at the end of each one.

I had the same issue with some patches I sent to David Miller.  I think
it's finally resolved.  My mailer was screwing with the last line in the
message.  Sorry about that.

Do you need me to resubmit the series?

Thanks,
Hartley
David Woodhouse - Jan. 5, 2010, 6:35 p.m.
On Tue, 2010-01-05 at 11:09 -0500, H Hartley Sweeten wrote:
> On Thursday, December 31, 2009 1:55 PM, David Woodhouse wrote:
> > On Mon, 2009-12-14 at 16:30 -0500, H Hartley Sweeten wrote:
> >> 
> >> -       release_mem_region(res0->start, res0->end - res0->start + 1);
> >> +       release_mem_region(res0->start, resouce_size(res0)); 
> >
> > That's not going to compile. I fixed it up.
> 
> Oops.. Sorry about that. Thanks for fixing.
> 
> > Every patch in this batch failed to apply cleanly with git-am, too --
> > there was something odd about the whitespace at the end of each one.
> 
> I had the same issue with some patches I sent to David Miller.  I think
> it's finally resolved.  My mailer was screwing with the last line in the
> message.  Sorry about that.
> 
> Do you need me to resubmit the series?

No, I have them. Thanks.

Patch

diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index 8f902e7..41f7d22 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -181,11 +181,11 @@  static int __devexit gpio_nand_remove(struct platform_device *dev)
 	res = platform_get_resource(dev, IORESOURCE_MEM, 1);
 	iounmap(gpiomtd->io_sync);
 	if (res)
-		release_mem_region(res->start, res->end - res->start + 1);
+		release_mem_region(res->start, resource_size(res));
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	iounmap(gpiomtd->nand_chip.IO_ADDR_R);
-	release_mem_region(res->start, res->end - res->start + 1);
+	release_mem_region(res->start, resource_size(res));
 
 	if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
 		gpio_set_value(gpiomtd->plat.gpio_nwp, 0);
@@ -208,14 +208,14 @@  static void __iomem *request_and_remap(struct resource *res, size_t size,
 {
 	void __iomem *ptr;
 
-	if (!request_mem_region(res->start, res->end - res->start + 1, name)) {
+	if (!request_mem_region(res->start, resource_size(res), name)) {
 		*err = -EBUSY;
 		return NULL;
 	}
 
 	ptr = ioremap(res->start, size);
 	if (!ptr) {
-		release_mem_region(res->start, res->end - res->start + 1);
+		release_mem_region(res->start, resource_size(res));
 		*err = -ENOMEM;
 	}
 	return ptr;
@@ -338,10 +338,10 @@  err_nwp:
 err_nce:
 	iounmap(gpiomtd->io_sync);
 	if (res1)
-		release_mem_region(res1->start, res1->end - res1->start + 1);
+		release_mem_region(res1->start, resource_size(res1));
 err_sync:
 	iounmap(gpiomtd->nand_chip.IO_ADDR_R);
-	release_mem_region(res0->start, res0->end - res0->start + 1);
+	release_mem_region(res0->start, resouce_size(res0));
 err_map:
 	kfree(gpiomtd);
 	return ret;