net: spread __net_init, __net_exit
[safe/jmp/linux-2.6] / drivers / net / natsemi.c
index c9bfe4e..2d7b3bb 100644 (file)
@@ -130,8 +130,8 @@ static int full_duplex[MAX_UNITS];
 static const char version[] __devinitconst =
   KERN_INFO DRV_NAME " dp8381x driver, version "
       DRV_VERSION ", " DRV_RELDATE "\n"
-  KERN_INFO "  originally by Donald Becker <becker@scyld.com>\n"
-  KERN_INFO "  2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n";
+  "  originally by Donald Becker <becker@scyld.com>\n"
+  "  2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
 MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver");
@@ -247,7 +247,7 @@ static struct {
        { "NatSemi DP8381[56]", 0, 24 },
 };
 
-static struct pci_device_id natsemi_pci_tbl[] __devinitdata = {
+static DEFINE_PCI_DEVICE_TABLE(natsemi_pci_tbl) = {
        { PCI_VENDOR_ID_NS, 0x0020, 0x12d9,     0x000c,     0, 0, 0 },
        { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1 },
        { }     /* terminate list */
@@ -621,7 +621,7 @@ static void drain_ring(struct net_device *dev);
 static void free_ring(struct net_device *dev);
 static void reinit_ring(struct net_device *dev);
 static void init_registers(struct net_device *dev);
-static int start_tx(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t intr_handler(int irq, void *dev_instance);
 static void netdev_error(struct net_device *dev, int intr_status);
 static int natsemi_poll(struct napi_struct *napi, int budget);
@@ -683,8 +683,8 @@ static ssize_t natsemi_set_dspcfg_workaround(struct device *dev,
         /* Find out the new setting */
         if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
                 new_setting = 1;
-        else if (!strncmp("off", buf, count - 1)
-                 || !strncmp("0", buf, count - 1))
+        else if (!strncmp("off", buf, count - 1) ||
+                 !strncmp("0", buf, count - 1))
                new_setting = 0;
        else
                  return count;
@@ -757,8 +757,8 @@ static void __devinit natsemi_init_media (struct net_device *dev)
        np->autoneg    = (tmp & BMCR_ANENABLE)? AUTONEG_ENABLE: AUTONEG_DISABLE;
        np->advertising= mdio_read(dev, MII_ADVERTISE);
 
-       if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL
-        && netif_msg_probe(np)) {
+       if ((np->advertising & ADVERTISE_ALL) != ADVERTISE_ALL &&
+           netif_msg_probe(np)) {
                printk(KERN_INFO "natsemi %s: Transceiver default autonegotiation %s "
                        "10%s %s duplex.\n",
                        pci_name(np->pci_dev),
@@ -1153,8 +1153,8 @@ static void init_phy_fixup(struct net_device *dev)
        tmp = mdio_read(dev, MII_BMCR);
        if (np->autoneg == AUTONEG_ENABLE) {
                /* renegotiate if something changed */
-               if ((tmp & BMCR_ANENABLE) == 0
-                || np->advertising != mdio_read(dev, MII_ADVERTISE))
+               if ((tmp & BMCR_ANENABLE) == 0 ||
+                   np->advertising != mdio_read(dev, MII_ADVERTISE))
                {
                        /* turn on autonegotiation and force negotiation */
                        tmp |= (BMCR_ANENABLE | BMCR_ANRESTART);
@@ -1535,7 +1535,7 @@ static int netdev_open(struct net_device *dev)
        /* Reset the chip, just in case. */
        natsemi_reset(dev);
 
-       i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
+       i = request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev);
        if (i) return i;
 
        if (netif_msg_ifup(np))
@@ -2079,7 +2079,7 @@ static void reinit_ring(struct net_device *dev)
        reinit_rx(dev);
 }
 
-static int start_tx(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
 {
        struct netdev_private *np = netdev_priv(dev);
        void __iomem * ioaddr = ns_ioaddr(dev);
@@ -2125,7 +2125,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
                printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
                        dev->name, np->cur_tx, entry);
        }
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static void netdev_tx_done(struct net_device *dev)
@@ -2164,8 +2164,8 @@ static void netdev_tx_done(struct net_device *dev)
                dev_kfree_skb_irq(np->tx_skbuff[entry]);
                np->tx_skbuff[entry] = NULL;
        }
-       if (netif_queue_stopped(dev)
-               && np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
+       if (netif_queue_stopped(dev) &&
+           np->cur_tx - np->dirty_tx < TX_QUEUE_LEN - 4) {
                /* The ring is no longer full, wake queue. */
                netif_wake_queue(dev);
        }
@@ -2343,8 +2343,8 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do)
                        /* Omit CRC size. */
                        /* Check if the packet is long enough to accept
                         * without copying to a minimally-sized skbuff. */
-                       if (pkt_len < rx_copybreak
-                           && (skb = dev_alloc_skb(pkt_len + RX_OFFSET)) != NULL) {
+                       if (pkt_len < rx_copybreak &&
+                           (skb = dev_alloc_skb(pkt_len + RX_OFFSET)) != NULL) {
                                /* 16 byte align the IP header */
                                skb_reserve(skb, RX_OFFSET);
                                pci_dma_sync_single_for_cpu(np->pci_dev,
@@ -2390,8 +2390,8 @@ static void netdev_error(struct net_device *dev, int intr_status)
        spin_lock(&np->lock);
        if (intr_status & LinkChange) {
                u16 lpa = mdio_read(dev, MII_LPA);
-               if (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE
-                && netif_msg_link(np)) {
+               if (mdio_read(dev, MII_BMCR) & BMCR_ANENABLE &&
+                   netif_msg_link(np)) {
                        printk(KERN_INFO
                                "%s: Autonegotiation advertising"
                                " %#04x  partner %#04x.\n", dev->name,
@@ -2488,8 +2488,8 @@ static void __set_rx_mode(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
                rx_mode = RxFilterEnable | AcceptBroadcast
                        | AcceptAllMulticast | AcceptAllPhys | AcceptMyPhys;
-       } else if ((dev->mc_count > multicast_filter_limit)
-         || (dev->flags & IFF_ALLMULTI)) {
+       } else if ((dev->mc_count > multicast_filter_limit) ||
+                  (dev->flags & IFF_ALLMULTI)) {
                rx_mode = RxFilterEnable | AcceptBroadcast
                        | AcceptAllMulticast | AcceptMyPhys;
        } else {
@@ -3053,12 +3053,10 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
        switch(cmd) {
        case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
-       case SIOCDEVPRIVATE:            /* for binary compat, remove in 2.5 */
                data->phy_id = np->phy_addr_external;
                /* Fall Through */
 
        case SIOCGMIIREG:               /* Read MII PHY register. */
-       case SIOCDEVPRIVATE+1:          /* for binary compat, remove in 2.5 */
                /* The phy_id is not enough to uniquely identify
                 * the intended target. Therefore the command is sent to
                 * the given mii on the current port.
@@ -3077,9 +3075,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                return 0;
 
        case SIOCSMIIREG:               /* Write MII PHY register. */
-       case SIOCDEVPRIVATE+2:          /* for binary compat, remove in 2.5 */
-               if (!capable(CAP_NET_ADMIN))
-                       return -EPERM;
                if (dev->if_port == PORT_TP) {
                        if ((data->phy_id & 0x1f) == np->phy_addr_external) {
                                if ((data->reg_num & 0x1f) == MII_ADVERTISE)