diff mbox

r8169: use u32 instead of unsigned long

Message ID 20100529040111.GA28225@host-a-55.ustcsz.edu.cn
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Junchang Wang May 29, 2010, 4:01 a.m. UTC
RTL_R32 should return value with 32-bit width. But "unsigned long"
implies u64 on some 64-bit platforms.

Signed-off-by: Junchang Wang <junchangwang@gmail.com>
---
Sorry for coding style flaw in previous email. 

drivers/net/r8169.c |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller May 29, 2010, 6:53 a.m. UTC | #1
From: Junchang Wang <junchangwang@gmail.com>
Date: Sat, 29 May 2010 12:01:11 +0800

> RTL_R32 should return value with 32-bit width. But "unsigned long"
> implies u64 on some 64-bit platforms.
> 
> Signed-off-by: Junchang Wang <junchangwang@gmail.com>

I fail to see why there is a need to cast the return value
of readl() at all.

It returns a 32-bit integer on all platforms.

Secondly, 8139too.c has the same unnecessary cast.

So the thing to do is to kill the casts completely from both
drivers defining this register read macro.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 217e709..4234d6a 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -88,7 +88,7 @@  static const int multicast_filter_limit = 32;
 #define RTL_W32(reg, val32)	writel ((val32), ioaddr + (reg))
 #define RTL_R8(reg)		readb (ioaddr + (reg))
 #define RTL_R16(reg)		readw (ioaddr + (reg))
-#define RTL_R32(reg)		((unsigned long) readl (ioaddr + (reg)))
+#define RTL_R32(reg)		((u32) readl(ioaddr + (reg)))
 
 enum mac_version {
 	RTL_GIGA_MAC_NONE   = 0x00,