mtd: ixp4xx map: use resource_size

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 30 05:59:02 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d6587feaf0ed7511b3d0b52bcaae8ecd0949d3af
Commit:     d6587feaf0ed7511b3d0b52bcaae8ecd0949d3af
Parent:     2af7c653993199fb32dc6d9504064a0c9c57e5d6
Author:     Tobias Klauser <tklauser at distanz.ch>
AuthorDate: Fri Oct 30 17:54:33 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Nov 30 09:47:24 2009 +0000

    mtd: ixp4xx map: use resource_size
    
    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 at distanz.ch>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/ixp4xx.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 7214b87..7b05152 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -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;



More information about the linux-mtd-cvs mailing list