[U-Boot] [PATCH 06/13] net: rtl8169: Build warning fixes for 64-bit

Thierry Reding thierry.reding at gmail.com
Fri Mar 20 12:41:21 CET 2015


From: Thierry Reding <treding at nvidia.com>

Turn ioaddr into an unsigned long rather than a sized 32-bit variable.
While at it, fix a couple of pointer to integer cast size mismatch
warnings by casting through unsigned long going from pointers to
integers and vice versa.

Cc: Joe Hershberger <joe.hershberger at gmail.com>
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 drivers/net/rtl8169.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 6c16c1bb403f..5feeb9cb7cbc 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -55,7 +55,7 @@
 #define drv_version "v1.5"
 #define drv_date "01-17-2004"
 
-static u32 ioaddr;
+static unsigned long ioaddr;
 
 /* Condensed operations for readability. */
 #define currticks()	get_timer(0)
@@ -97,14 +97,14 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 #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)		readl (ioaddr + (reg))
 
 #define ETH_FRAME_LEN	MAX_ETH_FRAME_SIZE
 #define ETH_ALEN	MAC_ADDR_LEN
 #define ETH_ZLEN	60
 
-#define bus_to_phys(a)	pci_mem_to_phys((pci_dev_t)dev->priv, (pci_addr_t)a)
-#define phys_to_bus(a)	pci_phys_to_mem((pci_dev_t)dev->priv, (phys_addr_t)a)
+#define bus_to_phys(a)	pci_mem_to_phys((pci_dev_t)(unsigned long)dev->priv, (pci_addr_t)(unsigned long)a)
+#define phys_to_bus(a)	pci_phys_to_mem((pci_dev_t)(unsigned long)dev->priv, (phys_addr_t)a)
 
 enum RTL8169_registers {
 	MAC0 = 0,		/* Ethernet hardware address. */
@@ -852,7 +852,7 @@ static int rtl_init(struct eth_device *dev, bd_t *bis)
 
 #ifdef DEBUG_RTL8169
 	/* Print out some hardware info */
-	printf("%s: at ioaddr 0x%x\n", dev->name, ioaddr);
+	printf("%s: at ioaddr 0x%lx\n", dev->name, ioaddr);
 #endif
 
 	/* if TBI is not endbled */
@@ -1008,7 +1008,7 @@ int rtl8169_initialize(bd_t *bis)
 		memset(dev, 0, sizeof(*dev));
 		sprintf (dev->name, "RTL8169#%d", card_number);
 
-		dev->priv = (void *) devno;
+		dev->priv = (void *)(unsigned long)devno;
 		dev->iobase = (int)pci_mem_to_phys(devno, iobase);
 
 		dev->init = rtl_reset;
-- 
2.3.2



More information about the U-Boot mailing list