Merge branch 'linus' into cont_syslog
[safe/jmp/linux-2.6] / drivers / net / cs89x0.c
index 7433b88..2ccb9f1 100644 (file)
 #include <linux/ioport.h>
 #include <linux/in.h>
 #include <linux/skbuff.h>
-#include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
+#include <linux/gfp.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -177,13 +177,10 @@ static unsigned int cs8900_irq_map[] = {1,0,0,0};
 #elif defined(CONFIG_MACH_IXDP2351)
 static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0};
 static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0};
-#include <asm/irq.h>
 #elif defined(CONFIG_ARCH_IXDP2X01)
-#include <asm/irq.h>
 static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0};
 static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0};
 #elif defined(CONFIG_ARCH_PNX010X)
-#include <asm/irq.h>
 #include <mach/gpio.h>
 #define CIRRUS_DEFAULT_BASE    IO_ADDRESS(EXT_STATIC2_s0_BASE + 0x200000)      /* = Physical address 0x48200000 */
 #define CIRRUS_DEFAULT_IRQ     VH_INTC_INT_NUM_CASCADED_INTERRUPT_1 /* Event inputs bank 1 - ID 35/bit 3 */
@@ -249,7 +246,7 @@ struct net_local {
 
 static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular);
 static int net_open(struct net_device *dev);
-static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t net_interrupt(int irq, void *dev_id);
 static void set_multicast_list(struct net_device *dev);
 static void net_timeout(struct net_device *dev);
@@ -583,7 +580,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular)
        }
 
 #ifdef CONFIG_SH_HICOSH4
-       /* truely reset the chip */
+       /* truly reset the chip */
        writeword(ioaddr, ADD_PORT, 0x0114);
        writeword(ioaddr, DATA_PORT, 0x0040);
 #endif
@@ -905,7 +902,6 @@ get_dma_channel(struct net_device *dev)
                        return;
                }
        }
-       return;
 }
 
 static void
@@ -1326,10 +1322,9 @@ net_open(struct net_device *dev)
                writereg(dev, PP_BusCTL, ENABLE_IRQ | MEMORY_ON);
 #endif
                write_irq(dev, lp->chip_type, dev->irq);
-               ret = request_irq(dev->irq, &net_interrupt, 0, dev->name, dev);
+               ret = request_irq(dev->irq, net_interrupt, 0, dev->name, dev);
                if (ret) {
-                       if (net_debug)
-                               printk(KERN_DEBUG "cs89x0: request_irq(%d) failed\n", dev->irq);
+                       printk(KERN_ERR "cs89x0: request_irq(%d) failed\n", dev->irq);
                        goto bad_out;
                }
        }
@@ -1367,7 +1362,7 @@ net_open(struct net_device *dev)
                        spin_lock_irqsave(&lp->lock, flags);
                        disable_dma(dev->dma);
                        clear_dma_ff(dev->dma);
-                       set_dma_mode(dev->dma, 0x14); /* auto_init as well */
+                       set_dma_mode(dev->dma, DMA_RX_MODE); /* auto_init as well */
                        set_dma_addr(dev->dma, isa_virt_to_bus(lp->dma_buff));
                        set_dma_count(dev->dma, lp->dmasize*1024);
                        enable_dma(dev->dma);
@@ -1521,9 +1516,10 @@ static void net_timeout(struct net_device *dev)
        netif_wake_queue(dev);
 }
 
-static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t net_send_packet(struct sk_buff *skb,struct net_device *dev)
 {
        struct net_local *lp = netdev_priv(dev);
+       unsigned long flags;
 
        if (net_debug > 3) {
                printk("%s: sent %d byte packet of type %x\n",
@@ -1535,7 +1531,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
                   ask the chip to start transmitting before the
                   whole packet has been completely uploaded. */
 
-       spin_lock_irq(&lp->lock);
+       spin_lock_irqsave(&lp->lock, flags);
        netif_stop_queue(dev);
 
        /* initiate a transmit sequence */
@@ -1549,15 +1545,14 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
                 * we're waiting for TxOk, so return 1 and requeue this packet.
                 */
 
-               spin_unlock_irq(&lp->lock);
+               spin_unlock_irqrestore(&lp->lock, flags);
                if (net_debug) printk("cs89x0: Tx buffer not free!\n");
-               return 1;
+               return NETDEV_TX_BUSY;
        }
        /* Write the contents of the packet */
        writewords(dev->base_addr, TX_FRAME_PORT,skb->data,(skb->len+1) >>1);
-       spin_unlock_irq(&lp->lock);
+       spin_unlock_irqrestore(&lp->lock, flags);
        lp->stats.tx_bytes += skb->len;
-       dev->trans_start = jiffies;
        dev_kfree_skb (skb);
 
        /*
@@ -1571,7 +1566,7 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev)
         * to restart the netdevice layer
         */
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /* The typical workload of the driver:
@@ -1676,7 +1671,6 @@ count_rx_errors(int status, struct net_local *lp)
                /* per str 172 */
                lp->stats.rx_crc_errors++;
        if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++;
-       return;
 }
 
 /* We have a good packet(s), get it/them out of the buffers. */
@@ -1788,7 +1782,7 @@ static void set_multicast_list(struct net_device *dev)
        {
                lp->rx_mode = RX_ALL_ACCEPT;
        }
-       else if((dev->flags&IFF_ALLMULTI)||dev->mc_list)
+       else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev))
        {
                /* The multicast-accept list is initialized to accept-all, and we
                   rely on higher-level filtering for now. */