mfd: asic3: use resource_size macro instead of local variable
authorPhilipp Zabel <philipp.zabel@gmail.com>
Fri, 5 Jun 2009 16:31:04 +0000 (18:31 +0200)
committerSamuel Ortiz <sameol@linux.intel.com>
Wed, 17 Jun 2009 17:41:44 +0000 (19:41 +0200)
This should make the code a little bit easier to read.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/asic3.c

index ebe889392b6dac1206bfcd69860d320dce284a2f..d5dd0dfae8720d4b70e6433d7555cb70fe50b984 100644 (file)
@@ -623,7 +623,6 @@ static int __init asic3_probe(struct platform_device *pdev)
        struct asic3 *asic;
        struct resource *mem;
        unsigned long clksel;
-       int map_size;
        int ret = 0;
 
        asic = kzalloc(sizeof(struct asic3), GFP_KERNEL);
@@ -643,8 +642,7 @@ static int __init asic3_probe(struct platform_device *pdev)
                goto out_free;
        }
 
-       map_size = mem->end - mem->start + 1;
-       asic->mapping = ioremap(mem->start, map_size);
+       asic->mapping = ioremap(mem->start, resource_size(mem));
        if (!asic->mapping) {
                ret = -ENOMEM;
                dev_err(asic->dev, "Couldn't ioremap\n");
@@ -654,7 +652,7 @@ static int __init asic3_probe(struct platform_device *pdev)
        asic->irq_base = pdata->irq_base;
 
        /* calculate bus shift from mem resource */
-       asic->bus_shift = 2 - (map_size >> 12);
+       asic->bus_shift = 2 - (resource_size(mem) >> 12);
 
        clksel = 0;
        asic3_write_register(asic, ASIC3_OFFSET(CLOCK, SEL), clksel);