aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-pca-platform.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2009-06-13 18:20:36 -0400
committerBen Dooks <ben-linux@fluff.org>2009-06-16 17:42:16 -0400
commitc6ffddea36dd576b70dfbd10eb5d2b287b786dca (patch)
tree9849cac5ca77534e38b4cb3c35a09d980ae84ff3 /drivers/i2c/busses/i2c-pca-platform.c
parent18904c0ecdf2cf22347da2adc4b273e9570333d8 (diff)
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 <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-pca-platform.c')
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 7b23891b7d59..c4df9d411cd5 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -27,8 +27,6 @@
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30#define res_len(r) ((r)->end - (r)->start + 1)
31
32struct i2c_pca_pf_data { 30struct i2c_pca_pf_data {
33 void __iomem *reg_base; 31 void __iomem *reg_base;
34 int irq; /* if 0, use polling */ 32 int irq; /* if 0, use polling */
@@ -148,7 +146,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
148 goto e_print; 146 goto e_print;
149 } 147 }
150 148
151 if (!request_mem_region(res->start, res_len(res), res->name)) { 149 if (!request_mem_region(res->start, resource_size(res), res->name)) {
152 ret = -ENOMEM; 150 ret = -ENOMEM;
153 goto e_print; 151 goto e_print;
154 } 152 }
@@ -161,13 +159,13 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
161 159
162 init_waitqueue_head(&i2c->wait); 160 init_waitqueue_head(&i2c->wait);
163 161
164 i2c->reg_base = ioremap(res->start, res_len(res)); 162 i2c->reg_base = ioremap(res->start, resource_size(res));
165 if (!i2c->reg_base) { 163 if (!i2c->reg_base) {
166 ret = -ENOMEM; 164 ret = -ENOMEM;
167 goto e_remap; 165 goto e_remap;
168 } 166 }
169 i2c->io_base = res->start; 167 i2c->io_base = res->start;
170 i2c->io_size = res_len(res); 168 i2c->io_size = resource_size(res);
171 i2c->irq = irq; 169 i2c->irq = irq;
172 170
173 i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0; 171 i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0;
@@ -250,7 +248,7 @@ e_reqirq:
250e_remap: 248e_remap:
251 kfree(i2c); 249 kfree(i2c);
252e_alloc: 250e_alloc:
253 release_mem_region(res->start, res_len(res)); 251 release_mem_region(res->start, resource_size(res));
254e_print: 252e_print:
255 printk(KERN_ERR "Registering PCA9564/PCA9665 FAILED! (%d)\n", ret); 253 printk(KERN_ERR "Registering PCA9564/PCA9665 FAILED! (%d)\n", ret);
256 return ret; 254 return ret;