diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2009-10-30 12:54:33 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-11-30 04:47:24 -0500 |
commit | d6587feaf0ed7511b3d0b52bcaae8ecd0949d3af (patch) | |
tree | cfd13ef9280472485342cc1384989fbc87d5fda9 | |
parent | 2af7c653993199fb32dc6d9504064a0c9c57e5d6 (diff) |
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@distanz.ch>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | 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 7214b876feba..7b0515297411 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) | |||
210 | * not attempt to do a direct access on us. | 210 | * not attempt to do a direct access on us. |
211 | */ | 211 | */ |
212 | info->map.phys = NO_XIP; | 212 | info->map.phys = NO_XIP; |
213 | info->map.size = dev->resource->end - dev->resource->start + 1; | 213 | info->map.size = resource_size(dev->resource); |
214 | 214 | ||
215 | /* | 215 | /* |
216 | * We only support 16-bit accesses for now. If and when | 216 | * We only support 16-bit accesses for now. If and when |
@@ -224,7 +224,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
224 | info->map.copy_from = ixp4xx_copy_from, | 224 | info->map.copy_from = ixp4xx_copy_from, |
225 | 225 | ||
226 | info->res = request_mem_region(dev->resource->start, | 226 | info->res = request_mem_region(dev->resource->start, |
227 | dev->resource->end - dev->resource->start + 1, | 227 | resource_size(dev->resource), |
228 | "IXP4XXFlash"); | 228 | "IXP4XXFlash"); |
229 | if (!info->res) { | 229 | if (!info->res) { |
230 | printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n"); | 230 | printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n"); |
@@ -233,7 +233,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | info->map.virt = ioremap(dev->resource->start, | 235 | info->map.virt = ioremap(dev->resource->start, |
236 | dev->resource->end - dev->resource->start + 1); | 236 | resource_size(dev->resource)); |
237 | if (!info->map.virt) { | 237 | if (!info->map.virt) { |
238 | printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); | 238 | printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); |
239 | err = -EIO; | 239 | err = -EIO; |