netdev: remove HAVE_ leftovers
[safe/jmp/linux-2.6] / drivers / net / tsi108_eth.c
index 6f33f84..a69c4a4 100644 (file)
@@ -162,6 +162,7 @@ static struct platform_driver tsi_eth_driver = {
        .remove = tsi108_ether_remove,
        .driver = {
                .name = "tsi-ethernet",
+               .owner = THIS_MODULE,
        },
 };
 
@@ -262,7 +263,7 @@ static inline void tsi108_write_tbi(struct tsi108_prv_data *data,
                        return;
                udelay(10);
        }
-       printk(KERN_ERR "%s function time out \n", __FUNCTION__);
+       printk(KERN_ERR "%s function time out \n", __func__);
 }
 
 static int mii_speed(struct mii_if_info *mii)
@@ -787,7 +788,6 @@ static int tsi108_complete_rx(struct net_device *dev, int budget)
                skb_put(skb, data->rxring[rx].len);
                skb->protocol = eth_type_trans(skb, dev);
                netif_receive_skb(skb);
-               dev->last_rx = jiffies;
        }
 
        return done;
@@ -802,12 +802,11 @@ static int tsi108_refill_rx(struct net_device *dev, int budget)
                int rx = data->rxhead;
                struct sk_buff *skb;
 
-               data->rxskbs[rx] = skb = dev_alloc_skb(TSI108_RXBUF_SIZE + 2);
+               skb = netdev_alloc_skb_ip_align(dev, TSI108_RXBUF_SIZE);
+               data->rxskbs[rx] = skb;
                if (!skb)
                        break;
 
-               skb_reserve(skb, 2); /* Align the data on a 4-byte boundary. */
-
                data->rxring[rx].buf0 = dma_map_single(NULL, skb->data,
                                                        TSI108_RX_SKB_SIZE,
                                                        DMA_FROM_DEVICE);
@@ -887,7 +886,7 @@ static int tsi108_poll(struct napi_struct *napi, int budget)
 
        if (num_received < budget) {
                data->rxpending = 0;
-               netif_rx_complete(dev, napi);
+               napi_complete(napi);
 
                TSI_WRITE(TSI108_EC_INTMASK,
                                     TSI_READ(TSI108_EC_INTMASK)
@@ -914,11 +913,11 @@ static void tsi108_rx_int(struct net_device *dev)
         *
         * This can happen if this code races with tsi108_poll(), which masks
         * the interrupts after tsi108_irq_one() read the mask, but before
-        * netif_rx_schedule is called.  It could also happen due to calls
+        * napi_schedule is called.  It could also happen due to calls
         * from tsi108_check_rxring().
         */
 
-       if (netif_rx_schedule_prep(dev, &data->napi)) {
+       if (napi_schedule_prep(&data->napi)) {
                /* Mask, rather than ack, the receive interrupts.  The ack
                 * will happen in tsi108_poll().
                 */
@@ -929,7 +928,7 @@ static void tsi108_rx_int(struct net_device *dev)
                                     | TSI108_INT_RXTHRESH |
                                     TSI108_INT_RXOVERRUN | TSI108_INT_RXERROR |
                                     TSI108_INT_RXWAIT);
-               __netif_rx_schedule(dev, &data->napi);
+               __napi_schedule(&data->napi);
        } else {
                if (!netif_running(dev)) {
                        /* This can happen if an interrupt occurs while the
@@ -1057,7 +1056,7 @@ static void tsi108_stop_ethernet(struct net_device *dev)
                        return;
                udelay(10);
        }
-       printk(KERN_ERR "%s function time out \n", __FUNCTION__);
+       printk(KERN_ERR "%s function time out \n", __func__);
 }
 
 static void tsi108_reset_ether(struct tsi108_prv_data * data)
@@ -1131,7 +1130,9 @@ static int tsi108_get_mac(struct net_device *dev)
        }
 
        if (!is_valid_ether_addr(dev->dev_addr)) {
-               printk("KERN_ERR: word1: %08x, word2: %08x\n", word1, word2);
+               printk(KERN_ERR
+                      "%s: Invalid MAC address. word1: %08x, word2: %08x\n",
+                      dev->name, word1, word2);
                return -EINVAL;
        }
 
@@ -1200,8 +1201,8 @@ static void tsi108_set_rx_mode(struct net_device *dev)
                                __set_bit(hash, &data->mc_hash[0]);
                        } else {
                                printk(KERN_ERR
-                                      "%s: got multicast address of length %d "
-                                      "instead of 6.\n", dev->name,
+               "%s: got multicast address of length %d instead of 6.\n",
+                                      dev->name,
                                       mc->dmi_addrlen);
                        }
 
@@ -1236,13 +1237,13 @@ static void tsi108_init_phy(struct net_device *dev)
        spin_lock_irqsave(&phy_lock, flags);
 
        tsi108_write_mii(data, MII_BMCR, BMCR_RESET);
-       while (i--){
+       while (--i) {
                if(!(tsi108_read_mii(data, MII_BMCR) & BMCR_RESET))
                        break;
                udelay(10);
        }
        if (i == 0)
-               printk(KERN_ERR "%s function time out \n", __FUNCTION__);
+               printk(KERN_ERR "%s function time out \n", __func__);
 
        if (data->phy_type == TSI108_PHY_BCM54XX) {
                tsi108_write_mii(data, 0x09, 0x0300);
@@ -1351,8 +1352,9 @@ static int tsi108_open(struct net_device *dev)
        data->rxhead = 0;
 
        for (i = 0; i < TSI108_RXRING_LEN; i++) {
-               struct sk_buff *skb = dev_alloc_skb(TSI108_RXBUF_SIZE + NET_IP_ALIGN);
+               struct sk_buff *skb;
 
+               skb = netdev_alloc_skb_ip_align(dev, TSI108_RXBUF_SIZE);
                if (!skb) {
                        /* Bah.  No memory for now, but maybe we'll get
                         * some more later.
@@ -1366,8 +1368,6 @@ static int tsi108_open(struct net_device *dev)
                }
 
                data->rxskbs[i] = skb;
-               /* Align the payload on a 4-byte boundary */
-               skb_reserve(skb, 2);
                data->rxskbs[i] = skb;
                data->rxring[i].buf0 = virt_to_phys(data->rxskbs[i]->data);
                data->rxring[i].misc = TSI108_RX_OWN | TSI108_RX_INT;
@@ -1434,7 +1434,6 @@ static int tsi108_close(struct net_device *dev)
                dev_kfree_skb(skb);
        }
 
-       synchronize_irq(data->irq_num);
        free_irq(data->irq_num, dev);
 
        /* Discard the RX ring. */
@@ -1525,7 +1524,7 @@ static int tsi108_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        struct tsi108_prv_data *data = netdev_priv(dev);
        unsigned long flags;
        int rc;
-       
+
        spin_lock_irqsave(&data->txlock, flags);
        rc = mii_ethtool_gset(&data->mii_if, cmd);
        spin_unlock_irqrestore(&data->txlock, flags);
@@ -1542,7 +1541,7 @@ static int tsi108_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        spin_lock_irqsave(&data->txlock, flags);
        rc = mii_ethtool_sset(&data->mii_if, cmd);
        spin_unlock_irqrestore(&data->txlock, flags);
-       
+
        return rc;
 }
 
@@ -1560,6 +1559,18 @@ static const struct ethtool_ops tsi108_ethtool_ops = {
        .set_settings   = tsi108_set_settings,
 };
 
+static const struct net_device_ops tsi108_netdev_ops = {
+       .ndo_open               = tsi108_open,
+       .ndo_stop               = tsi108_close,
+       .ndo_start_xmit         = tsi108_send_packet,
+       .ndo_set_multicast_list = tsi108_set_rx_mode,
+       .ndo_get_stats          = tsi108_get_stats,
+       .ndo_do_ioctl           = tsi108_do_ioctl,
+       .ndo_set_mac_address    = tsi108_set_mac,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_change_mtu         = eth_change_mtu,
+};
+
 static int
 tsi108_init_one(struct platform_device *pdev)
 {
@@ -1567,7 +1578,6 @@ tsi108_init_one(struct platform_device *pdev)
        struct tsi108_prv_data *data = NULL;
        hw_info *einfo;
        int err = 0;
-       DECLARE_MAC_BUF(mac);
 
        einfo = pdev->dev.platform_data;
 
@@ -1616,14 +1626,8 @@ tsi108_init_one(struct platform_device *pdev)
        data->phy_type = einfo->phy_type;
        data->irq_num = einfo->irq_num;
        data->id = pdev->id;
-       dev->open = tsi108_open;
-       dev->stop = tsi108_close;
-       dev->hard_start_xmit = tsi108_send_packet;
-       dev->set_mac_address = tsi108_set_mac;
-       dev->set_multicast_list = tsi108_set_rx_mode;
-       dev->get_stats = tsi108_get_stats;
        netif_napi_add(dev, &data->napi, tsi108_poll, 64);
-       dev->do_ioctl = tsi108_do_ioctl;
+       dev->netdev_ops = &tsi108_netdev_ops;
        dev->ethtool_ops = &tsi108_ethtool_ops;
 
        /* Apparently, the Linux networking code won't use scatter-gather
@@ -1657,8 +1661,8 @@ tsi108_init_one(struct platform_device *pdev)
        }
 
        platform_set_drvdata(pdev, dev);
-       printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n",
-              dev->name, print_mac(mac, dev->dev_addr));
+       printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %pM\n",
+              dev->name, dev->dev_addr);
 #ifdef DEBUG
        data->msg_enable = DEBUG;
        dump_eth_one(dev);
@@ -1729,3 +1733,4 @@ module_exit(tsi108_ether_exit);
 MODULE_AUTHOR("Tundra Semiconductor Corporation");
 MODULE_DESCRIPTION("Tsi108 Gigabit Ethernet driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:tsi-ethernet");