提交 7e3d7db5 编写于 作者: T Tobias Klauser 提交者: Greg Kroah-Hartman

[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: NTobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 8104a9a9
......@@ -121,14 +121,11 @@ static struct i2c_adapter parport_adapter = {
static int __init i2c_parport_init(void)
{
int type_count;
type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
if (type < 0 || type >= type_count) {
if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
type = 0;
}
if (base == 0) {
printk(KERN_INFO "i2c-parport: using default base 0x%x\n", DEFAULT_BASE);
base = DEFAULT_BASE;
......@@ -152,7 +149,7 @@ static int __init i2c_parport_init(void)
release_region(base, 3);
return -ENODEV;
}
return 0;
}
......
......@@ -241,14 +241,11 @@ static struct parport_driver i2c_parport_driver = {
static int __init i2c_parport_init(void)
{
int type_count;
type_count = sizeof(adapter_parm)/sizeof(struct adapter_parm);
if (type < 0 || type >= type_count) {
if (type < 0 || type >= ARRAY_SIZE(adapter_parm)) {
printk(KERN_WARNING "i2c-parport: invalid type (%d)\n", type);
type = 0;
}
return parport_register_driver(&i2c_parport_driver);
}
......
......@@ -861,7 +861,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id, struct pt_regs *r
decode_ISR(isr);
}
if (i2c->irqlogidx < sizeof(i2c->isrlog)/sizeof(u32))
if (i2c->irqlogidx < ARRAY_SIZE(i2c->isrlog))
i2c->isrlog[i2c->irqlogidx++] = isr;
show_state(i2c);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册