ath9k_hw: Move some RF ops to the private callbacks
[safe/jmp/linux-2.6] / drivers / net / eexpress.c
index 1686dca..7013dc8 100644 (file)
@@ -246,7 +246,8 @@ static char mca_irqmap[] = { 12, 9, 3, 4, 5, 10, 11, 15 };
 static int eexp_open(struct net_device *dev);
 static int eexp_close(struct net_device *dev);
 static void eexp_timeout(struct net_device *dev);
-static int eexp_xmit(struct sk_buff *buf, struct net_device *dev);
+static netdev_tx_t eexp_xmit(struct sk_buff *buf,
+                            struct net_device *dev);
 
 static irqreturn_t eexp_irq(int irq, void *dev_addr);
 static void eexp_set_multicast(struct net_device *dev);
@@ -456,7 +457,7 @@ static int eexp_open(struct net_device *dev)
        if (!dev->irq || !irqrmap[dev->irq])
                return -ENXIO;
 
-       ret = request_irq(dev->irq, &eexp_irq, 0, dev->name, dev);
+       ret = request_irq(dev->irq, eexp_irq, 0, dev->name, dev);
        if (ret)
                return ret;
 
@@ -650,7 +651,7 @@ static void eexp_timeout(struct net_device *dev)
  * Called to transmit a packet, or to allow us to right ourselves
  * if the kernel thinks we've died.
  */
-static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
+static netdev_tx_t eexp_xmit(struct sk_buff *buf, struct net_device *dev)
 {
        short length = buf->len;
 #ifdef CONFIG_SMP
@@ -664,7 +665,7 @@ static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
 
        if (buf->len < ETH_ZLEN) {
                if (skb_padto(buf, ETH_ZLEN))
-                       return 0;
+                       return NETDEV_TX_OK;
                length = ETH_ZLEN;
        }
 
@@ -691,7 +692,7 @@ static int eexp_xmit(struct sk_buff *buf, struct net_device *dev)
        spin_unlock_irqrestore(&lp->lock, flags);
 #endif
        enable_irq(dev->irq);
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -1474,13 +1475,13 @@ static void eexp_hw_init586(struct net_device *dev)
        outw(0x0000, ioaddr + 0x800c);
        outw(0x0000, ioaddr + 0x800e);
 
-       for (i = 0; i < (sizeof(start_code)); i+=32) {
+       for (i = 0; i < ARRAY_SIZE(start_code) * 2; i+=32) {
                int j;
                outw(i, ioaddr + SM_PTR);
-               for (j = 0; j < 16; j+=2)
+               for (j = 0; j < 16 && (i+j)/2 < ARRAY_SIZE(start_code); j+=2)
                        outw(start_code[(i+j)/2],
                             ioaddr+0x4000+j);
-               for (j = 0; j < 16; j+=2)
+               for (j = 0; j < 16 && (i+j+16)/2 < ARRAY_SIZE(start_code); j+=2)
                        outw(start_code[(i+j+16)/2],
                             ioaddr+0x8000+j);
        }
@@ -1577,7 +1578,7 @@ static void eexp_setup_filter(struct net_device *dev)
 {
        struct dev_mc_list *dmi;
        unsigned short ioaddr = dev->base_addr;
-       int count = dev->mc_count;
+       int count = netdev_mc_count(dev);
        int i;
        if (count > 8) {
                printk(KERN_INFO "%s: too many multicast addresses (%d)\n",
@@ -1587,23 +1588,19 @@ static void eexp_setup_filter(struct net_device *dev)
 
        outw(CONF_NR_MULTICAST & ~31, ioaddr+SM_PTR);
        outw(6*count, ioaddr+SHADOW(CONF_NR_MULTICAST));
-       for (i = 0, dmi = dev->mc_list; i < count; i++, dmi = dmi->next) {
-               unsigned short *data;
-               if (!dmi) {
-                       printk(KERN_INFO "%s: too few multicast addresses\n", dev->name);
+       i = 0;
+       netdev_for_each_mc_addr(dmi, dev) {
+               unsigned short *data = (unsigned short *) dmi->dmi_addr;
+
+               if (i == count)
                        break;
-               }
-               if (dmi->dmi_addrlen != ETH_ALEN) {
-                       printk(KERN_INFO "%s: invalid multicast address length given.\n", dev->name);
-                       continue;
-               }
-               data = (unsigned short *)dmi->dmi_addr;
                outw((CONF_MULTICAST+(6*i)) & ~31, ioaddr+SM_PTR);
                outw(data[0], ioaddr+SHADOW(CONF_MULTICAST+(6*i)));
                outw((CONF_MULTICAST+(6*i)+2) & ~31, ioaddr+SM_PTR);
                outw(data[1], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+2));
                outw((CONF_MULTICAST+(6*i)+4) & ~31, ioaddr+SM_PTR);
                outw(data[2], ioaddr+SHADOW(CONF_MULTICAST+(6*i)+4));
+               i++;
        }
 }
 
@@ -1626,9 +1623,9 @@ eexp_set_multicast(struct net_device *dev)
         }
         if (!(dev->flags & IFF_PROMISC)) {
                 eexp_setup_filter(dev);
-                if (lp->old_mc_count != dev->mc_count) {
+                if (lp->old_mc_count != netdev_mc_count(dev)) {
                         kick = 1;
-                        lp->old_mc_count = dev->mc_count;
+                        lp->old_mc_count = netdev_mc_count(dev);
                 }
         }
         if (kick) {