Commit db5a5ae2 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by David Woodhouse

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

Use resource_size().
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 58e6a84d
...@@ -181,11 +181,11 @@ static int __devexit gpio_nand_remove(struct platform_device *dev) ...@@ -181,11 +181,11 @@ static int __devexit gpio_nand_remove(struct platform_device *dev)
res = platform_get_resource(dev, IORESOURCE_MEM, 1); res = platform_get_resource(dev, IORESOURCE_MEM, 1);
iounmap(gpiomtd->io_sync); iounmap(gpiomtd->io_sync);
if (res) 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); res = platform_get_resource(dev, IORESOURCE_MEM, 0);
iounmap(gpiomtd->nand_chip.IO_ADDR_R); 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)) if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
gpio_set_value(gpiomtd->plat.gpio_nwp, 0); gpio_set_value(gpiomtd->plat.gpio_nwp, 0);
...@@ -208,14 +208,14 @@ static void __iomem *request_and_remap(struct resource *res, size_t size, ...@@ -208,14 +208,14 @@ static void __iomem *request_and_remap(struct resource *res, size_t size,
{ {
void __iomem *ptr; 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; *err = -EBUSY;
return NULL; return NULL;
} }
ptr = ioremap(res->start, size); ptr = ioremap(res->start, size);
if (!ptr) { if (!ptr) {
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
*err = -ENOMEM; *err = -ENOMEM;
} }
return ptr; return ptr;
...@@ -338,10 +338,10 @@ static int __devinit gpio_nand_probe(struct platform_device *dev) ...@@ -338,10 +338,10 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
err_nce: err_nce:
iounmap(gpiomtd->io_sync); iounmap(gpiomtd->io_sync);
if (res1) if (res1)
release_mem_region(res1->start, res1->end - res1->start + 1); release_mem_region(res1->start, resource_size(res1));
err_sync: err_sync:
iounmap(gpiomtd->nand_chip.IO_ADDR_R); iounmap(gpiomtd->nand_chip.IO_ADDR_R);
release_mem_region(res0->start, res0->end - res0->start + 1); release_mem_region(res0->start, resource_size(res0));
err_map: err_map:
kfree(gpiomtd); kfree(gpiomtd);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment