net: convert multicast list to list_head
[safe/jmp/linux-2.6] / drivers / net / smc911x.c
index 211213c..6278734 100644 (file)
@@ -220,9 +220,9 @@ static void smc911x_reset(struct net_device *dev)
 
        /* make sure EEPROM has finished loading before setting GPIO_CFG */
        timeout=1000;
-       while ( timeout-- && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_)) {
+       while (--timeout && (SMC_GET_E2P_CMD(lp) & E2P_CMD_EPC_BUSY_))
                udelay(10);
-       }
+
        if (timeout == 0){
                PRINTK("%s: smc911x_reset timeout waiting for EEPROM busy\n", dev->name);
                return;
@@ -383,7 +383,7 @@ static inline void   smc911x_rcv(struct net_device *dev)
        DBG(SMC_DEBUG_FUNC | SMC_DEBUG_RX, "%s: --> %s\n",
                dev->name, __func__);
        status = SMC_GET_RX_STS_FIFO(lp);
-       DBG(SMC_DEBUG_RX, "%s: Rx pkt len %d status 0x%08x \n",
+       DBG(SMC_DEBUG_RX, "%s: Rx pkt len %d status 0x%08x\n",
                dev->name, (status & 0x3fff0000) >> 16, status & 0xc000ffff);
        pkt_len = (status & RX_STS_PKT_LEN_) >> 16;
        if (status & RX_STS_ES_) {
@@ -553,7 +553,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                dev->stats.tx_dropped++;
                spin_unlock_irqrestore(&lp->lock, flags);
                dev_kfree_skb(skb);
-               return 0;
+               return NETDEV_TX_OK;
        }
 
 #ifdef SMC_USE_DMA
@@ -566,7 +566,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        lp->pending_tx_skb = skb;
                        netif_stop_queue(dev);
                        spin_unlock_irqrestore(&lp->lock, flags);
-                       return 0;
+                       return NETDEV_TX_OK;
                } else {
                        DBG(SMC_DEBUG_TX | SMC_DEBUG_DMA, "%s: Activating Tx DMA\n", dev->name);
                        lp->txdma_active = 1;
@@ -577,7 +577,7 @@ static int smc911x_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        smc911x_hardware_send_pkt(dev);
        spin_unlock_irqrestore(&lp->lock, flags);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -1136,7 +1136,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
                }
 #else
                if (status & INT_STS_TSFL_) {
-                       DBG(SMC_DEBUG_TX, "%s: TX status FIFO limit (%d) irq \n", dev->name, );
+                       DBG(SMC_DEBUG_TX, "%s: TX status FIFO limit (%d) irq\n", dev->name, );
                        smc911x_tx(dev);
                        SMC_ACK_INT(lp, INT_STS_TSFL_);
                }
@@ -1275,7 +1275,7 @@ static void smc911x_timeout(struct net_device *dev)
        status = SMC_GET_INT(lp);
        mask = SMC_GET_INT_EN(lp);
        spin_unlock_irqrestore(&lp->lock, flags);
-       DBG(SMC_DEBUG_MISC, "%s: INT 0x%02x MASK 0x%02x \n",
+       DBG(SMC_DEBUG_MISC, "%s: INT 0x%02x MASK 0x%02x\n",
                dev->name, status, mask);
 
        /* Dump the current TX FIFO contents and restart */
@@ -1323,7 +1323,7 @@ static void smc911x_set_multicast_list(struct net_device *dev)
         * I don't need to zero the multicast table, because the flag is
         * checked before the table is
         */
-       else if (dev->flags & IFF_ALLMULTI || dev->mc_count > 16) {
+       else if (dev->flags & IFF_ALLMULTI || netdev_mc_count(dev) > 16) {
                DBG(SMC_DEBUG_MISC, "%s: RCR_ALMUL\n", dev->name);
                mcr |= MAC_CR_MCPAS_;
        }
@@ -1340,9 +1340,8 @@ static void smc911x_set_multicast_list(struct net_device *dev)
         * the number of the 32 bit register, while the low 5 bits are the bit
         * within that register.
         */
-       else if (dev->mc_count)  {
-               int i;
-               struct dev_mc_list *cur_addr;
+       else if (!netdev_mc_empty(dev)) {
+               struct netdev_hw_addr *ha;
 
                /* Set the Hash perfec mode */
                mcr |= MAC_CR_HPFILT_;
@@ -1350,20 +1349,16 @@ static void smc911x_set_multicast_list(struct net_device *dev)
                /* start with a table of all zeros: reject all */
                memset(multicast_table, 0, sizeof(multicast_table));
 
-               cur_addr = dev->mc_list;
-               for (i = 0; i < dev->mc_count; i++, cur_addr = cur_addr->next) {
+               netdev_for_each_mc_addr(ha, dev) {
                        u32 position;
 
-                       /* do we have a pointer here? */
-                       if (!cur_addr)
-                               break;
                        /* make sure this is a multicast address -
                                shouldn't this be a given if we have it here ? */
-                       if (!(*cur_addr->dmi_addr & 1))
-                                continue;
+                       if (!(*ha->addr & 1))
+                               continue;
 
                        /* upper 6 bits are used as hash index */
-                       position = ether_crc(ETH_ALEN, cur_addr->dmi_addr)>>26;
+                       position = ether_crc(ETH_ALEN, ha->addr)>>26;
 
                        multicast_table[position>>5] |= 1 << (position&0x1f);
                }
@@ -1774,6 +1769,20 @@ static int __devinit smc911x_findirq(struct net_device *dev)
        return probe_irq_off(cookie);
 }
 
+static const struct net_device_ops smc911x_netdev_ops = {
+       .ndo_open               = smc911x_open,
+       .ndo_stop               = smc911x_close,
+       .ndo_start_xmit         = smc911x_hard_start_xmit,
+       .ndo_tx_timeout         = smc911x_timeout,
+       .ndo_set_multicast_list = smc911x_set_multicast_list,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = smc911x_poll_controller,
+#endif
+};
+
 /*
  * Function: smc911x_probe(unsigned long ioaddr)
  *
@@ -1940,16 +1949,9 @@ static int __devinit smc911x_probe(struct net_device *dev)
        /* Fill in the fields of the device structure with ethernet values. */
        ether_setup(dev);
 
-       dev->open = smc911x_open;
-       dev->stop = smc911x_close;
-       dev->hard_start_xmit = smc911x_hard_start_xmit;
-       dev->tx_timeout = smc911x_timeout;
+       dev->netdev_ops = &smc911x_netdev_ops;
        dev->watchdog_timeo = msecs_to_jiffies(watchdog);
-       dev->set_multicast_list = smc911x_set_multicast_list;
        dev->ethtool_ops = &smc911x_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = smc911x_poll_controller;
-#endif
 
        INIT_WORK(&lp->phy_configure, smc911x_phy_configure);
        lp->mii.phy_id_mask = 0x1f;
@@ -1977,7 +1979,7 @@ static int __devinit smc911x_probe(struct net_device *dev)
 #endif
 
        /* Grab the IRQ */
-       retval = request_irq(dev->irq, &smc911x_interrupt,
+       retval = request_irq(dev->irq, smc911x_interrupt,
                             irq_flags, dev->name, dev);
        if (retval)
                goto err_out;
@@ -2010,10 +2012,8 @@ static int __devinit smc911x_probe(struct net_device *dev)
                                        "set using ifconfig\n", dev->name);
                } else {
                        /* Print the Ethernet address */
-                       printk("%s: Ethernet addr: ", dev->name);
-                       for (i = 0; i < 5; i++)
-                               printk("%2.2x:", dev->dev_addr[i]);
-                       printk("%2.2x\n", dev->dev_addr[5]);
+                       printk("%s: Ethernet addr: %pM\n",
+                               dev->name, dev->dev_addr);
                }
 
                if (lp->phy_type == 0) {