From c6ffddea36dd576b70dfbd10eb5d2b287b786dca Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sun, 14 Jun 2009 00:20:36 +0200 Subject: i2c: Use resource_size macro This replace all instances in the i2c busses tree of res->end - res->start + 1 with the handy macro resource_size(res) from ioport.h (coming in from platform_device.h). This was created with a simple sed -i -e 's/\([a-z]*\)->end *- *[a-z]*->start *+ *1/resource_size(\1)/g' Then manually replacing the PXA redefiniton of the same kind of macro manually. Recompiled some ARM defconfigs I could find to make a rough test so it shouldn't break anything, though I couldn't see exactly which configs you need for all the drivers. Signed-off-by: Linus Walleij Signed-off-by: Ben Dooks --- drivers/i2c/busses/i2c-pxa.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers/i2c/busses/i2c-pxa.c') diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 035a6c7e59d..762e1e53088 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -993,7 +993,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = { .functionality = i2c_pxa_functionality, }; -#define res_len(r) ((r)->end - (r)->start + 1) static int i2c_pxa_probe(struct platform_device *dev) { struct pxa_i2c *i2c; @@ -1008,7 +1007,7 @@ static int i2c_pxa_probe(struct platform_device *dev) if (res == NULL || irq < 0) return -ENODEV; - if (!request_mem_region(res->start, res_len(res), res->name)) + if (!request_mem_region(res->start, resource_size(res), res->name)) return -ENOMEM; i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL); @@ -1038,7 +1037,7 @@ static int i2c_pxa_probe(struct platform_device *dev) goto eclk; } - i2c->reg_base = ioremap(res->start, res_len(res)); + i2c->reg_base = ioremap(res->start, resource_size(res)); if (!i2c->reg_base) { ret = -EIO; goto eremap; @@ -1046,7 +1045,7 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c->reg_shift = REG_SHIFT(id->driver_data); i2c->iobase = res->start; - i2c->iosize = res_len(res); + i2c->iosize = resource_size(res); i2c->irq = irq; @@ -1110,7 +1109,7 @@ eremap: eclk: kfree(i2c); emalloc: - release_mem_region(res->start, res_len(res)); + release_mem_region(res->start, resource_size(res)); return ret; } -- cgit v1.2.3