aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-10-05 20:19:47 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:27 -0400
commitddfce6bb43c6bf1c9956e7a65ce1b2e19a156bd2 (patch)
tree38e871422ccb6168ae84ca6e33e9374715c3df9b
parent43b7c451a03fe5f615710e26e8e2a3dd70eaa5b1 (diff)
network drivers: sparse warning fixes
Fix some of the easy warnings in network device drivers. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/acenic.c37
-rw-r--r--drivers/net/atl1/atl1_main.c5
-rw-r--r--drivers/net/dl2k.c8
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/hamachi.c3
-rw-r--r--drivers/net/natsemi.c6
-rw-r--r--drivers/net/tehuti.c4
7 files changed, 32 insertions, 33 deletions
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 2c2ed6dc98bc..6c192650d349 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -406,7 +406,7 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
406#define DEF_STAT (2 * TICKS_PER_SEC) 406#define DEF_STAT (2 * TICKS_PER_SEC)
407 407
408 408
409static int link[ACE_MAX_MOD_PARMS]; 409static int link_state[ACE_MAX_MOD_PARMS];
410static int trace[ACE_MAX_MOD_PARMS]; 410static int trace[ACE_MAX_MOD_PARMS];
411static int tx_coal_tick[ACE_MAX_MOD_PARMS]; 411static int tx_coal_tick[ACE_MAX_MOD_PARMS];
412static int rx_coal_tick[ACE_MAX_MOD_PARMS]; 412static int rx_coal_tick[ACE_MAX_MOD_PARMS];
@@ -419,7 +419,7 @@ MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>");
419MODULE_LICENSE("GPL"); 419MODULE_LICENSE("GPL");
420MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver"); 420MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
421 421
422module_param_array(link, int, NULL, 0); 422module_param_array_named(link, link_state, int, NULL, 0);
423module_param_array(trace, int, NULL, 0); 423module_param_array(trace, int, NULL, 0);
424module_param_array(tx_coal_tick, int, NULL, 0); 424module_param_array(tx_coal_tick, int, NULL, 0);
425module_param_array(max_tx_desc, int, NULL, 0); 425module_param_array(max_tx_desc, int, NULL, 0);
@@ -987,27 +987,27 @@ static int __devinit ace_init(struct net_device *dev)
987 987
988 mac1 = 0; 988 mac1 = 0;
989 for(i = 0; i < 4; i++) { 989 for(i = 0; i < 4; i++) {
990 int tmp; 990 int t;
991 991
992 mac1 = mac1 << 8; 992 mac1 = mac1 << 8;
993 tmp = read_eeprom_byte(dev, 0x8c+i); 993 t = read_eeprom_byte(dev, 0x8c+i);
994 if (tmp < 0) { 994 if (t < 0) {
995 ecode = -EIO; 995 ecode = -EIO;
996 goto init_error; 996 goto init_error;
997 } else 997 } else
998 mac1 |= (tmp & 0xff); 998 mac1 |= (t & 0xff);
999 } 999 }
1000 mac2 = 0; 1000 mac2 = 0;
1001 for(i = 4; i < 8; i++) { 1001 for(i = 4; i < 8; i++) {
1002 int tmp; 1002 int t;
1003 1003
1004 mac2 = mac2 << 8; 1004 mac2 = mac2 << 8;
1005 tmp = read_eeprom_byte(dev, 0x8c+i); 1005 t = read_eeprom_byte(dev, 0x8c+i);
1006 if (tmp < 0) { 1006 if (t < 0) {
1007 ecode = -EIO; 1007 ecode = -EIO;
1008 goto init_error; 1008 goto init_error;
1009 } else 1009 } else
1010 mac2 |= (tmp & 0xff); 1010 mac2 |= (t & 0xff);
1011 } 1011 }
1012 1012
1013 writel(mac1, &regs->MacAddrHi); 1013 writel(mac1, &regs->MacAddrHi);
@@ -1305,10 +1305,10 @@ static int __devinit ace_init(struct net_device *dev)
1305 writel(TX_RING_BASE, &regs->WinBase); 1305 writel(TX_RING_BASE, &regs->WinBase);
1306 1306
1307 if (ACE_IS_TIGON_I(ap)) { 1307 if (ACE_IS_TIGON_I(ap)) {
1308 ap->tx_ring = (struct tx_desc *) regs->Window; 1308 ap->tx_ring = (__force struct tx_desc *) regs->Window;
1309 for (i = 0; i < (TIGON_I_TX_RING_ENTRIES 1309 for (i = 0; i < (TIGON_I_TX_RING_ENTRIES
1310 * sizeof(struct tx_desc)) / sizeof(u32); i++) 1310 * sizeof(struct tx_desc)) / sizeof(u32); i++)
1311 writel(0, (void __iomem *)ap->tx_ring + i * 4); 1311 writel(0, (__force void __iomem *)ap->tx_ring + i * 4);
1312 1312
1313 set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE); 1313 set_aceaddr(&info->tx_ctrl.rngptr, TX_RING_BASE);
1314 } else { 1314 } else {
@@ -1394,8 +1394,8 @@ static int __devinit ace_init(struct net_device *dev)
1394 /* 1394 /*
1395 * Override link default parameters 1395 * Override link default parameters
1396 */ 1396 */
1397 if ((board_idx >= 0) && link[board_idx]) { 1397 if ((board_idx >= 0) && link_state[board_idx]) {
1398 int option = link[board_idx]; 1398 int option = link_state[board_idx];
1399 1399
1400 tmp = LNK_ENABLE; 1400 tmp = LNK_ENABLE;
1401 1401
@@ -2383,8 +2383,9 @@ static int ace_close(struct net_device *dev)
2383 2383
2384 if (mapping) { 2384 if (mapping) {
2385 if (ACE_IS_TIGON_I(ap)) { 2385 if (ACE_IS_TIGON_I(ap)) {
2386 struct tx_desc __iomem *tx 2386 /* NB: TIGON_1 is special, tx_ring is in io space */
2387 = (struct tx_desc __iomem *) &ap->tx_ring[i]; 2387 struct tx_desc __iomem *tx;
2388 tx = (__force struct tx_desc __iomem *) &ap->tx_ring[i];
2388 writel(0, &tx->addr.addrhi); 2389 writel(0, &tx->addr.addrhi);
2389 writel(0, &tx->addr.addrlo); 2390 writel(0, &tx->addr.addrlo);
2390 writel(0, &tx->flagsize); 2391 writel(0, &tx->flagsize);
@@ -2444,7 +2445,7 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr,
2444#endif 2445#endif
2445 2446
2446 if (ACE_IS_TIGON_I(ap)) { 2447 if (ACE_IS_TIGON_I(ap)) {
2447 struct tx_desc __iomem *io = (struct tx_desc __iomem *) desc; 2448 struct tx_desc __iomem *io = (__force struct tx_desc __iomem *) desc;
2448 writel(addr >> 32, &io->addr.addrhi); 2449 writel(addr >> 32, &io->addr.addrhi);
2449 writel(addr & 0xffffffff, &io->addr.addrlo); 2450 writel(addr & 0xffffffff, &io->addr.addrlo);
2450 writel(flagsize, &io->flagsize); 2451 writel(flagsize, &io->flagsize);
@@ -2936,7 +2937,7 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz
2936 * This operation requires the NIC to be halted and is performed with 2937 * This operation requires the NIC to be halted and is performed with
2937 * interrupts disabled and with the spinlock hold. 2938 * interrupts disabled and with the spinlock hold.
2938 */ 2939 */
2939int __devinit ace_load_firmware(struct net_device *dev) 2940static int __devinit ace_load_firmware(struct net_device *dev)
2940{ 2941{
2941 struct ace_private *ap = netdev_priv(dev); 2942 struct ace_private *ap = netdev_priv(dev);
2942 struct ace_regs __iomem *regs = ap->regs; 2943 struct ace_regs __iomem *regs = ap->regs;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 4c728f1169c4..35b0a7dd4ef4 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1367,7 +1367,6 @@ rrd_ok:
1367 if (count) { 1367 if (count) {
1368 u32 tpd_next_to_use; 1368 u32 tpd_next_to_use;
1369 u32 rfd_next_to_use; 1369 u32 rfd_next_to_use;
1370 u32 rrd_next_to_clean;
1371 1370
1372 spin_lock(&adapter->mb_lock); 1371 spin_lock(&adapter->mb_lock);
1373 1372
@@ -1512,7 +1511,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
1512 unsigned int f; 1511 unsigned int f;
1513 u16 tpd_next_to_use; 1512 u16 tpd_next_to_use;
1514 u16 proto_hdr_len; 1513 u16 proto_hdr_len;
1515 u16 i, m, len12; 1514 u16 len12;
1516 1515
1517 first_buf_len -= skb->data_len; 1516 first_buf_len -= skb->data_len;
1518 nr_frags = skb_shinfo(skb)->nr_frags; 1517 nr_frags = skb_shinfo(skb)->nr_frags;
@@ -1536,6 +1535,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
1536 tpd_next_to_use = 0; 1535 tpd_next_to_use = 0;
1537 1536
1538 if (first_buf_len > proto_hdr_len) { 1537 if (first_buf_len > proto_hdr_len) {
1538 int i, m;
1539
1539 len12 = first_buf_len - proto_hdr_len; 1540 len12 = first_buf_len - proto_hdr_len;
1540 m = (len12 + ATL1_MAX_TX_BUF_LEN - 1) / 1541 m = (len12 + ATL1_MAX_TX_BUF_LEN - 1) /
1541 ATL1_MAX_TX_BUF_LEN; 1542 ATL1_MAX_TX_BUF_LEN;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index e91b7096838a..5066beb2e7bc 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -290,7 +290,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
290 return err; 290 return err;
291} 291}
292 292
293int 293static int
294find_miiphy (struct net_device *dev) 294find_miiphy (struct net_device *dev)
295{ 295{
296 int i, phy_found = 0; 296 int i, phy_found = 0;
@@ -314,7 +314,7 @@ find_miiphy (struct net_device *dev)
314 return 0; 314 return 0;
315} 315}
316 316
317int 317static int
318parse_eeprom (struct net_device *dev) 318parse_eeprom (struct net_device *dev)
319{ 319{
320 int i, j; 320 int i, j;
@@ -1096,7 +1096,7 @@ clear_stats (struct net_device *dev)
1096} 1096}
1097 1097
1098 1098
1099int 1099static int
1100change_mtu (struct net_device *dev, int new_mtu) 1100change_mtu (struct net_device *dev, int new_mtu)
1101{ 1101{
1102 struct netdev_private *np = netdev_priv(dev); 1102 struct netdev_private *np = netdev_priv(dev);
@@ -1331,7 +1331,7 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1331#define EEP_BUSY 0x8000 1331#define EEP_BUSY 0x8000
1332/* Read the EEPROM word */ 1332/* Read the EEPROM word */
1333/* We use I/O instruction to read/write eeprom to avoid fail on some machines */ 1333/* We use I/O instruction to read/write eeprom to avoid fail on some machines */
1334int 1334static int
1335read_eeprom (long ioaddr, int eep_addr) 1335read_eeprom (long ioaddr, int eep_addr)
1336{ 1336{
1337 int i = 1000; 1337 int i = 1000;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 7bd960402687..64f35e20fd48 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1990,7 +1990,7 @@ static int e100_poll(struct napi_struct *napi, int budget)
1990{ 1990{
1991 struct nic *nic = container_of(napi, struct nic, napi); 1991 struct nic *nic = container_of(napi, struct nic, napi);
1992 struct net_device *netdev = nic->netdev; 1992 struct net_device *netdev = nic->netdev;
1993 int work_done = 0; 1993 unsigned int work_done = 0;
1994 int tx_cleaned; 1994 int tx_cleaned;
1995 1995
1996 e100_rx_clean(nic, &work_done, budget); 1996 e100_rx_clean(nic, &work_done, budget);
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index 015ed3a4057f..ed407c85708f 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -1017,7 +1017,7 @@ static inline int hamachi_tx(struct net_device *dev)
1017 break; 1017 break;
1018 /* Free the original skb. */ 1018 /* Free the original skb. */
1019 skb = hmp->tx_skbuff[entry]; 1019 skb = hmp->tx_skbuff[entry];
1020 if (skb != 0) { 1020 if (skb) {
1021 pci_unmap_single(hmp->pci_dev, 1021 pci_unmap_single(hmp->pci_dev,
1022 hmp->tx_ring[entry].addr, skb->len, 1022 hmp->tx_ring[entry].addr, skb->len,
1023 PCI_DMA_TODEVICE); 1023 PCI_DMA_TODEVICE);
@@ -1069,7 +1069,6 @@ static void hamachi_tx_timeout(struct net_device *dev)
1069 " resetting...\n", dev->name, (int)readw(ioaddr + TxStatus)); 1069 " resetting...\n", dev->name, (int)readw(ioaddr + TxStatus));
1070 1070
1071 { 1071 {
1072 int i;
1073 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); 1072 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring);
1074 for (i = 0; i < RX_RING_SIZE; i++) 1073 for (i = 0; i < RX_RING_SIZE; i++)
1075 printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length); 1074 printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length);
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index ea38da6d31ff..322d16974000 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -1615,7 +1615,7 @@ static void do_cable_magic(struct net_device *dev)
1615 * (these values all come from National) 1615 * (these values all come from National)
1616 */ 1616 */
1617 if (!(data & 0x80) || ((data >= 0xd8) && (data <= 0xff))) { 1617 if (!(data & 0x80) || ((data >= 0xd8) && (data <= 0xff))) {
1618 struct netdev_private *np = netdev_priv(dev); 1618 np = netdev_priv(dev);
1619 1619
1620 /* the bug has been triggered - fix the coefficient */ 1620 /* the bug has been triggered - fix the coefficient */
1621 writew(TSTDAT_FIXED, ioaddr + TSTDAT); 1621 writew(TSTDAT_FIXED, ioaddr + TSTDAT);
@@ -2502,8 +2502,8 @@ static void __set_rx_mode(struct net_device *dev)
2502 memset(mc_filter, 0, sizeof(mc_filter)); 2502 memset(mc_filter, 0, sizeof(mc_filter));
2503 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; 2503 for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
2504 i++, mclist = mclist->next) { 2504 i++, mclist = mclist->next) {
2505 int i = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 23) & 0x1ff; 2505 int b = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 23) & 0x1ff;
2506 mc_filter[i/8] |= (1 << (i & 0x07)); 2506 mc_filter[b/8] |= (1 << (b & 0x07));
2507 } 2507 }
2508 rx_mode = RxFilterEnable | AcceptBroadcast 2508 rx_mode = RxFilterEnable | AcceptBroadcast
2509 | AcceptMulticast | AcceptMyPhys; 2509 | AcceptMulticast | AcceptMyPhys;
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 248343177356..8d04654f0c59 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -750,7 +750,6 @@ bdx_vlan_rx_register(struct net_device *ndev, struct vlan_group *grp)
750 */ 750 */
751static int bdx_change_mtu(struct net_device *ndev, int new_mtu) 751static int bdx_change_mtu(struct net_device *ndev, int new_mtu)
752{ 752{
753 BDX_ASSERT(ndev == 0);
754 ENTER; 753 ENTER;
755 754
756 if (new_mtu == ndev->mtu) 755 if (new_mtu == ndev->mtu)
@@ -1002,7 +1001,7 @@ static inline void bdx_rxdb_free_elem(struct rxdb *db, int n)
1002static int bdx_rx_init(struct bdx_priv *priv) 1001static int bdx_rx_init(struct bdx_priv *priv)
1003{ 1002{
1004 ENTER; 1003 ENTER;
1005 BDX_ASSERT(priv == 0); 1004
1006 if (bdx_fifo_init(priv, &priv->rxd_fifo0.m, priv->rxd_size, 1005 if (bdx_fifo_init(priv, &priv->rxd_fifo0.m, priv->rxd_size,
1007 regRXD_CFG0_0, regRXD_CFG1_0, 1006 regRXD_CFG0_0, regRXD_CFG1_0,
1008 regRXD_RPTR_0, regRXD_WPTR_0)) 1007 regRXD_RPTR_0, regRXD_WPTR_0))
@@ -1747,7 +1746,6 @@ static void bdx_tx_cleanup(struct bdx_priv *priv)
1747 tx_level -= db->rptr->len; /* '-' koz len is negative */ 1746 tx_level -= db->rptr->len; /* '-' koz len is negative */
1748 1747
1749 /* now should come skb pointer - free it */ 1748 /* now should come skb pointer - free it */
1750 BDX_ASSERT(db->rptr->addr.skb == 0);
1751 dev_kfree_skb_irq(db->rptr->addr.skb); 1749 dev_kfree_skb_irq(db->rptr->addr.skb);
1752 bdx_tx_db_inc_rptr(db); 1750 bdx_tx_db_inc_rptr(db);
1753 } 1751 }