* [PATCH] net: fix SONIC_READ definition
@ 2009-01-03 18:43 Roel Kluin
2009-01-05 6:42 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-01-03 18:43 UTC (permalink / raw)
To: netdev; +Cc: lkml
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?
------------->8---------8<------------------
Fix SONIC_READ definition
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
index 334ff9e..b872f23 100644
--- a/drivers/net/jazzsonic.c
+++ b/drivers/net/jazzsonic.c
@@ -53,7 +53,7 @@ static char jazz_sonic_string[] = "jazzsonic";
/*
* Macros to access SONIC registers
*/
-#define SONIC_READ(reg) (*((volatile unsigned int *)dev->base_addr+reg))
+#define SONIC_READ(reg) (*((volatile unsigned int *)dev->base_addr+(reg)))
#define SONIC_WRITE(reg,val) \
do { \
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: fix SONIC_READ definition
2009-01-03 18:43 [PATCH] net: fix SONIC_READ definition Roel Kluin
@ 2009-01-05 6:42 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-01-05 6:42 UTC (permalink / raw)
To: roel.kluin; +Cc: netdev, linux-kernel
From: Roel Kluin <roel.kluin@gmail.com>
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 :-)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-05 6:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03 18:43 [PATCH] net: fix SONIC_READ definition Roel Kluin
2009-01-05 6:42 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).