Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[safe/jmp/linux-2.6] / drivers / net / starfire.c
index da3a76b..6dfa698 100644 (file)
@@ -178,9 +178,9 @@ static int full_duplex[MAX_UNITS] = {0, };
 #define FIRMWARE_TX    "adaptec/starfire_tx.bin"
 
 /* These identify the driver base version and may not be removed. */
-static char version[] =
+static const char version[] __devinitconst =
 KERN_INFO "starfire.c:v1.03 7/26/2000  Written by Donald Becker <becker@scyld.com>\n"
-KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n";
+" (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
 MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver");
@@ -301,7 +301,7 @@ enum chipset {
        CH_6915 = 0,
 };
 
-static struct pci_device_id starfire_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(starfire_pci_tbl) = {
        { 0x9004, 0x6915, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_6915 },
        { 0, }
 };
@@ -595,7 +595,7 @@ static int  netdev_open(struct net_device *dev);
 static void    check_duplex(struct net_device *dev);
 static void    tx_timeout(struct net_device *dev);
 static void    init_ring(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     __netdev_rx(struct net_device *dev, int *quota);
@@ -928,7 +928,7 @@ static int netdev_open(struct net_device *dev)
 
        /* Do we ever need to reset the chip??? */
 
-       retval = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
+       retval = request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev);
        if (retval)
                return retval;
 
@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev)
        if (retval) {
                printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
                       FIRMWARE_RX);
-               return retval;
+               goto out_init;
        }
        if (fw_rx->size % 4) {
                printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
@@ -1108,6 +1108,9 @@ out_tx:
        release_firmware(fw_tx);
 out_rx:
        release_firmware(fw_rx);
+out_init:
+       if (retval)
+               netdev_close(dev);
        return retval;
 }
 
@@ -1223,7 +1226,7 @@ static void init_ring(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)
 {
        struct netdev_private *np = netdev_priv(dev);
        unsigned int entry;
@@ -1236,7 +1239,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
         */
        if ((np->cur_tx - np->dirty_tx) + skb_num_frags(skb) * 2 > TX_RING_SIZE) {
                netif_stop_queue(dev);
-               return 1;
+               return NETDEV_TX_BUSY;
        }
 
 #if defined(ZEROCOPY) && defined(HAS_BROKEN_FIRMWARE)
@@ -1311,7 +1314,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
 
        dev->trans_start = jiffies;
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 
@@ -1342,8 +1345,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                if (intr_status & (IntrRxDone | IntrRxEmpty)) {
                        u32 enable;
 
-                       if (likely(netif_rx_schedule_prep(&np->napi))) {
-                               __netif_rx_schedule(&np->napi);
+                       if (likely(napi_schedule_prep(&np->napi))) {
+                               __napi_schedule(&np->napi);
                                enable = readl(ioaddr + IntrEnable);
                                enable &= ~(IntrRxDone | IntrRxEmpty);
                                writel(enable, ioaddr + IntrEnable);
@@ -1482,8 +1485,8 @@ static int __netdev_rx(struct net_device *dev, int *quota)
                        printk(KERN_DEBUG "  netdev_rx() normal Rx pkt length %d, quota %d.\n", pkt_len, *quota);
                /* 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 + 2)) != NULL) {
+               if (pkt_len < rx_copybreak &&
+                   (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
                        skb_reserve(skb, 2);    /* 16 byte align the IP header */
                        pci_dma_sync_single_for_cpu(np->pci_dev,
                                                    np->rx_info[entry].mapping,
@@ -1587,7 +1590,7 @@ static int netdev_poll(struct napi_struct *napi, int budget)
                intr_status = readl(ioaddr + IntrStatus);
        } while (intr_status & (IntrRxDone | IntrRxEmpty));
 
-       netif_rx_complete(napi);
+       napi_complete(napi);
        intr_status = readl(ioaddr + IntrEnable);
        intr_status |= IntrRxDone | IntrRxEmpty;
        writel(intr_status, ioaddr + IntrEnable);
@@ -1793,22 +1796,22 @@ static void set_rx_mode(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
                rx_mode |= AcceptAll;
-       } else if ((dev->mc_count > multicast_filter_limit)
-                  || (dev->flags & IFF_ALLMULTI)) {
+       } else if ((netdev_mc_count(dev) > multicast_filter_limit) ||
+                  (dev->flags & IFF_ALLMULTI)) {
                /* Too many to match, or accept all multicasts. */
                rx_mode |= AcceptBroadcast|AcceptAllMulticast|PerfectFilter;
-       } else if (dev->mc_count <= 14) {
+       } else if (netdev_mc_count(dev) <= 14) {
                /* Use the 16 element perfect filter, skip first two entries. */
                void __iomem *filter_addr = ioaddr + PerfFilterTable + 2 * 16;
                __be16 *eaddrs;
-               for (i = 2, mclist = dev->mc_list; mclist && i < dev->mc_count + 2;
-                    i++, mclist = mclist->next) {
+               netdev_for_each_mc_addr(mclist, dev) {
                        eaddrs = (__be16 *)mclist->dmi_addr;
                        writew(be16_to_cpu(eaddrs[2]), filter_addr); filter_addr += 4;
                        writew(be16_to_cpu(eaddrs[1]), filter_addr); filter_addr += 4;
                        writew(be16_to_cpu(eaddrs[0]), filter_addr); filter_addr += 8;
                }
                eaddrs = (__be16 *)dev->dev_addr;
+               i = netdev_mc_count(dev) + 2;
                while (i++ < 16) {
                        writew(be16_to_cpu(eaddrs[0]), filter_addr); filter_addr += 4;
                        writew(be16_to_cpu(eaddrs[1]), filter_addr); filter_addr += 4;
@@ -1822,8 +1825,7 @@ static void set_rx_mode(struct net_device *dev)
                __le16 mc_filter[32] __attribute__ ((aligned(sizeof(long))));   /* Multicast hash filter */
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-                    i++, mclist = mclist->next) {
+               netdev_for_each_mc_addr(mclist, dev) {
                        /* The chip uses the upper 9 CRC bits
                           as index into the hash table */
                        int bit_nr = ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 23;