drivers/net/rtl8139.c: Fix GCC 4.6 build warnings

Fix:
rtl8139.c: In function 'rtl8139_probe':
rtl8139.c:256:15: warning: variable 'fullduplex' set but not used
[-Wunused-but-set-variable]
rtl8139.c:256:6: warning: variable 'speed10' set but not used
[-Wunused-but-set-variable]
rtl8139.c: In function 'rtl_transmit':
rtl8139.c:419:16: warning: variable 'txstatus' set but not used
[-Wunused-but-set-variable]

Change code to use new debug macros; also fix the new errors and
warnigns popping up now, like "error: 'to' undeclared" and some
"warning: format '%X' expects argument of type 'unsigned int', but
argument X has type 'long unsigned int'"

Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
Wolfgang Denk 2011-11-05 05:13:03 +00:00
parent 53862da918
commit ecc6aa8cf3

View File

@ -95,10 +95,9 @@
#define RX_BUF_LEN_IDX 0 /* 0, 1, 2 is allowed - 8,16,32K rx buffer */ #define RX_BUF_LEN_IDX 0 /* 0, 1, 2 is allowed - 8,16,32K rx buffer */
#define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX) #define RX_BUF_LEN (8192 << RX_BUF_LEN_IDX)
#undef DEBUG_TX #define DEBUG_TX 0 /* set to 1 to enable debug code */
#undef DEBUG_RX #define DEBUG_RX 0 /* set to 1 to enable debug code */
#define currticks() get_timer(0)
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a) #define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a)
#define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a) #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
@ -253,7 +252,6 @@ int rtl8139_initialize(bd_t *bis)
static int rtl8139_probe(struct eth_device *dev, bd_t *bis) static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
{ {
int i; int i;
int speed10, fullduplex;
int addr_len; int addr_len;
unsigned short *ap = (unsigned short *)dev->enetaddr; unsigned short *ap = (unsigned short *)dev->enetaddr;
@ -266,9 +264,6 @@ static int rtl8139_probe(struct eth_device *dev, bd_t *bis)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
*ap++ = le16_to_cpu (read_eeprom(i + 7, addr_len)); *ap++ = le16_to_cpu (read_eeprom(i + 7, addr_len));
speed10 = inb(ioaddr + MediaStatus) & MSRSpeed10;
fullduplex = inw(ioaddr + MII_BMCR) & BMCRDuplex;
rtl_reset(dev); rtl_reset(dev);
if (inb(ioaddr + MediaStatus) & MSRLinkFail) { if (inb(ioaddr + MediaStatus) & MSRLinkFail) {
@ -389,9 +384,8 @@ static void rtl_reset(struct eth_device *dev)
* from the configuration EEPROM default, because the card manufacturer * from the configuration EEPROM default, because the card manufacturer
* should have set that to match the card. */ * should have set that to match the card. */
#ifdef DEBUG_RX debug_cond(DEBUG_RX,
printf("rx ring address is %X\n",(unsigned long)rx_ring); "rx ring address is %lX\n",(unsigned long)rx_ring);
#endif
flush_cache((unsigned long)rx_ring, RX_BUF_LEN); flush_cache((unsigned long)rx_ring, RX_BUF_LEN);
outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf); outl(phys_to_bus((int)rx_ring), ioaddr + RxBuf);
@ -424,9 +418,7 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengt
memcpy((char *)tx_buffer, (char *)packet, (int)length); memcpy((char *)tx_buffer, (char *)packet, (int)length);
#ifdef DEBUG_TX debug_cond(DEBUG_TX, "sending %d bytes\n", len);
printf("sending %d bytes\n", len);
#endif
/* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4 /* Note: RTL8139 doesn't auto-pad, send minimum payload (another 4
* bytes are sent automatically for the FCS, totalling to 64 bytes). */ * bytes are sent automatically for the FCS, totalling to 64 bytes). */
@ -453,16 +445,18 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengt
if (status & TxOK) { if (status & TxOK) {
cur_tx = (cur_tx + 1) % NUM_TX_DESC; cur_tx = (cur_tx + 1) % NUM_TX_DESC;
#ifdef DEBUG_TX
printf("tx done (%d ticks), status %hX txstatus %X\n", debug_cond(DEBUG_TX,
to-currticks(), status, txstatus); "tx done, status %hX txstatus %lX\n",
#endif status, txstatus);
return length; return length;
} else { } else {
#ifdef DEBUG_TX
printf("tx timeout/error (%d usecs), status %hX txstatus %X\n", debug_cond(DEBUG_TX,
10*i, status, txstatus); "tx timeout/error (%d usecs), status %hX txstatus %lX\n",
#endif 10*i, status, txstatus);
rtl_reset(dev); rtl_reset(dev);
return 0; return 0;
@ -486,9 +480,7 @@ static int rtl_poll(struct eth_device *dev)
/* See below for the rest of the interrupt acknowledges. */ /* See below for the rest of the interrupt acknowledges. */
outw(status & ~(RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus); outw(status & ~(RxFIFOOver | RxOverflow | RxOK), ioaddr + IntrStatus);
#ifdef DEBUG_RX debug_cond(DEBUG_RX, "rtl_poll: int %hX ", status);
printf("rtl_poll: int %hX ", status);
#endif
ring_offs = cur_rx % RX_BUF_LEN; ring_offs = cur_rx % RX_BUF_LEN;
/* ring_offs is guaranteed being 4-byte aligned */ /* ring_offs is guaranteed being 4-byte aligned */
@ -513,14 +505,11 @@ static int rtl_poll(struct eth_device *dev)
memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count); memcpy(&(rxdata[semi_count]), rx_ring, rx_size-4-semi_count);
NetReceive(rxdata, length); NetReceive(rxdata, length);
#ifdef DEBUG_RX debug_cond(DEBUG_RX, "rx packet %d+%d bytes",
printf("rx packet %d+%d bytes", semi_count,rx_size-4-semi_count); semi_count, rx_size-4-semi_count);
#endif
} else { } else {
NetReceive(rx_ring + ring_offs + 4, length); NetReceive(rx_ring + ring_offs + 4, length);
#ifdef DEBUG_RX debug_cond(DEBUG_RX, "rx packet %d bytes", rx_size-4);
printf("rx packet %d bytes", rx_size-4);
#endif
} }
flush_cache((unsigned long)rx_ring, RX_BUF_LEN); flush_cache((unsigned long)rx_ring, RX_BUF_LEN);