Re: [PATCH] net: fix SONIC_READ definition

From: David Miller
Date: Mon Jan 05 2009 - 01:42:53 EST


From: Roel Kluin <roel.kluin@xxxxxxxxx>
Date: Sat, 03 Jan 2009 19:43:24 +0100

> drivers/net/jazzsonic.c:56:
> #define SONIC_READ(reg) (*((volatile unsigned int *)dev->base_addr+reg))
>
> drivers/net/sonic.h:53:
> #define SONIC_CAP0 0x24
>
> so drivers/net/jazzsonic.c:143:
> val = SONIC_READ(SONIC_CAP0-i);
>
> becomes
>
> val = (*((volatile unsigned int *)dev->base_addr+0x24-i));
>
> That is wrong, isn't it?

The expression, both with and without the parentheses around "reg",
evaluate to the same final pointer value.

Compile a test program and look at the assembler output if you
don't believe me :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/