aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2006-01-09 17:19:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-02-06 15:02:15 -0500
commit7e3d7db52469f6bcfbfd2d3d00dd17da573facd9 (patch)
treec6090fda544c24ddf169177ee4596121b8bd10a6 /drivers/i2c/busses
parent8104a9a9c9ad8c849d931c46ef6841b23d1fc729 (diff)
[PATCH] i2c: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]). Some trailing whitespaces are also removed. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c9
-rw-r--r--drivers/i2c/busses/i2c-parport.c7
-rw-r--r--drivers/i2c/busses/i2c-pxa.c2
3 files changed, 6 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 3e5eba9fcacb..c63025a4c861 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -121,14 +121,11 @@ static struct i2c_adapter parport_adapter = {
121 121
122static int __init i2c_parport_init(void) 122static int __init i2c_parport_init(void)
123{ 123{
124 int type_count; 124 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
125
126 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
127 if (type < 0 || type >= type_count) {
128 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 125 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
129 type = 0; 126 type = 0;
130 } 127 }
131 128
132 if (base == 0) { 129 if (base == 0) {
133 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE); 130 printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
134 base = DEFAULT_BASE; 131 base = DEFAULT_BASE;
@@ -152,7 +149,7 @@ static int __init i2c_parport_init(void)
152 release_region(base, 3); 149 release_region(base, 3);
153 return -ENODEV; 150 return -ENODEV;
154 } 151 }
155 152
156 return 0; 153 return 0;
157} 154}
158 155
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 2854d858fc9b..7e2e8cd1c14a 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -241,14 +241,11 @@ static struct parport_driver i2c_parport_driver = {
241 241
242static int __init i2c_parport_init(void) 242static int __init i2c_parport_init(void)
243{ 243{
244 int type_count; 244 if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
245
246 type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
247 if (type < 0 || type >= type_count) {
248 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type); 245 printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
249 type = 0; 246 type = 0;
250 } 247 }
251 248
252 return parport_register_driver(&i2c_parport_driver); 249 return parport_register_driver(&i2c_parport_driver);
253} 250}
254 251
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 86e2234faf80..7579f4b256a8 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -861,7 +861,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id, struct pt_regs *r
861 decode_ISR(isr); 861 decode_ISR(isr);
862 } 862 }
863 863
864 if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32)) 864 if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))
865 i2c->isrlog[i2c->irqlogidx++] = isr; 865 i2c->isrlog[i2c->irqlogidx++] = isr;
866 866
867 show_state(i2c); 867 show_state(i2c);