netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] r8169: use u32 instead of unsigned long
@ 2010-05-26 14:01 Junchang Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Junchang Wang @ 2010-05-26 14:01 UTC (permalink / raw)
  To: romieu; +Cc: netdev

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>
---
 drivers/net/r8169.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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,
--


--Junchang

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Patch] r8169: use u32 instead of unsigned long
@ 2010-05-29  4:01 Junchang Wang
  2010-05-29  6:53 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Junchang Wang @ 2010-05-29  4:01 UTC (permalink / raw)
  To: romieu; +Cc: netdev

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(-)

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,
--

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch] r8169: use u32 instead of unsigned long
  2010-05-29  4:01 [Patch] r8169: use u32 instead of unsigned long Junchang Wang
@ 2010-05-29  6:53 ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-05-29  6:53 UTC (permalink / raw)
  To: junchangwang; +Cc: romieu, netdev

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-29  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-29  4:01 [Patch] r8169: use u32 instead of unsigned long Junchang Wang
2010-05-29  6:53 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2010-05-26 14:01 Junchang Wang

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).