Driver core: fix driver_register() return value
[safe/jmp/linux-2.6] / drivers / net / au1000_eth.c
index 6d76ccb..ce6f1ac 100644 (file)
@@ -34,6 +34,7 @@
  *
  *
  */
+#include <linux/capability.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -458,8 +459,8 @@ static int mii_probe (struct net_device *dev)
        /* now we are supposed to have a proper phydev, to attach to... */
        BUG_ON(phydev->attached_dev);
 
-       phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0,
-                       PHY_INTERFACE_MODE_MII);
+       phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link,
+                       0, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
                printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
@@ -484,8 +485,8 @@ static int mii_probe (struct net_device *dev)
        aup->phy_dev = phydev;
 
        printk(KERN_INFO "%s: attached PHY driver [%s] "
-              "(mii_bus:phy_addr=%s, irq=%d)\n",
-              dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+              "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
+              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        return 0;
 }
@@ -721,7 +722,7 @@ static inline void update_rx_stats(struct net_device *dev, u32 status)
                ps->rx_errors++;
                if (status & RX_MISSED_FRAME)
                        ps->rx_missed_errors++;
-               if (status & (RX_OVERLEN | RX_OVERLEN | RX_LEN_ERROR))
+               if (status & (RX_OVERLEN | RX_RUNT | RX_LEN_ERROR))
                        ps->rx_length_errors++;
                if (status & RX_CRC_ERROR)
                        ps->rx_crc_errors++;
@@ -794,8 +795,6 @@ static int au1000_rx(struct net_device *dev)
                                        printk("rx len error\n");
                                if (status & RX_U_CNTRL_FRAME)
                                        printk("rx u control frame\n");
-                               if (status & RX_MISSED_FRAME)
-                                       printk("rx miss\n");
                        }
                }
                prxd->buff_stat = (u32)(pDB->dma_addr | RX_DMA_ENABLE);
@@ -937,7 +936,7 @@ static int au1000_close(struct net_device *dev)
 /*
  * Au1000 transmit routine.
  */
-static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 {
        struct au1000_private *aup = netdev_priv(dev);
        struct net_device_stats *ps = &dev->stats;
@@ -957,7 +956,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
                /* We've wrapped around and the transmitter is still busy */
                netif_stop_queue(dev);
                aup->tx_full = 1;
-               return 1;
+               return NETDEV_TX_BUSY;
        }
        else if (buff_stat & TX_T_DONE) {
                update_tx_stats(dev, ptxd->status);
@@ -988,7 +987,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
        dev_kfree_skb(skb);
        aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
        dev->trans_start = jiffies;
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -1004,12 +1003,12 @@ static void au1000_tx_timeout(struct net_device *dev)
        netif_wake_queue(dev);
 }
 
-static void set_rx_mode(struct net_device *dev)
+static void au1000_multicast_list(struct net_device *dev)
 {
        struct au1000_private *aup = netdev_priv(dev);
 
        if (au1000_debug > 4)
-               printk("%s: set_rx_mode: flags=%x\n", dev->name, dev->flags);
+               printk("%s: au1000_multicast_list: flags=%x\n", dev->name, dev->flags);
 
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
                aup->mac->control |= MAC_PROMISCUOUS;
@@ -1047,6 +1046,18 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
 }
 
+static const struct net_device_ops au1000_netdev_ops = {
+       .ndo_open               = au1000_open,
+       .ndo_stop               = au1000_close,
+       .ndo_start_xmit         = au1000_tx,
+       .ndo_set_multicast_list = au1000_multicast_list,
+       .ndo_do_ioctl           = au1000_ioctl,
+       .ndo_tx_timeout         = au1000_tx_timeout,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_change_mtu         = eth_change_mtu,
+};
+
 static struct net_device * au1000_probe(int port_num)
 {
        static unsigned version_printed = 0;
@@ -1145,6 +1156,9 @@ static struct net_device * au1000_probe(int port_num)
        aup->mii_bus->name = "au1000_eth_mii";
        snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
        aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+       if (aup->mii_bus->irq == NULL)
+               goto err_out;
+
        for(i = 0; i < PHY_MAX_ADDR; ++i)
                aup->mii_bus->irq[i] = PHY_POLL;
 
@@ -1197,13 +1211,8 @@ static struct net_device * au1000_probe(int port_num)
 
        dev->base_addr = base;
        dev->irq = irq;
-       dev->open = au1000_open;
-       dev->hard_start_xmit = au1000_tx;
-       dev->stop = au1000_close;
-       dev->set_multicast_list = &set_rx_mode;
-       dev->do_ioctl = &au1000_ioctl;
+       dev->netdev_ops = &au1000_netdev_ops;
        SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
-       dev->tx_timeout = au1000_tx_timeout;
        dev->watchdog_timeo = ETH_TX_TIMEOUT;
 
        /*