mtd: ixp4xx map: use resource_size
authorTobias Klauser <tklauser@distanz.ch>
Fri, 30 Oct 2009 16:54:33 +0000 (17:54 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 30 Nov 2009 09:47:24 +0000 (09:47 +0000)
Use the resource_size inline function instead of manually calculating
the resource size. This reduces the chance of introducing off-by-one
errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/maps/ixp4xx.c

index 7214b876febaea91e339e5964a0d6c1cb463899f..7b0515297411fc092a3793222f95dd11c9adb6a8 100644 (file)
@@ -210,7 +210,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
         * not attempt to do a direct access on us.
         */
        info->map.phys = NO_XIP;
-       info->map.size = dev->resource->end - dev->resource->start + 1;
+       info->map.size = resource_size(dev->resource);
 
        /*
         * We only support 16-bit accesses for now. If and when
@@ -224,7 +224,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
        info->map.copy_from = ixp4xx_copy_from,
 
        info->res = request_mem_region(dev->resource->start,
-                       dev->resource->end - dev->resource->start + 1,
+                       resource_size(dev->resource),
                        "IXP4XXFlash");
        if (!info->res) {
                printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
@@ -233,7 +233,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
        }
 
        info->map.virt = ioremap(dev->resource->start,
-                                dev->resource->end - dev->resource->start + 1);
+                                resource_size(dev->resource));
        if (!info->map.virt) {
                printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
                err = -EIO;