fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / 82596.c
index c835712..640d7ca 100644 (file)
@@ -40,7 +40,6 @@
 
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -53,8 +52,8 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/init.h>
+#include <linux/bitops.h>
 
-#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/pgtable.h>
@@ -150,7 +149,7 @@ MODULE_AUTHOR("Richard Hirst");
 MODULE_DESCRIPTION("i82596 driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(i596_debug, "i");
+module_param(i596_debug, int, 0);
 MODULE_PARM_DESC(i596_debug, "i82596 debug mask");
 
 
@@ -358,7 +357,7 @@ static char init_setup[] =
 
 static int i596_open(struct net_device *dev);
 static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t i596_interrupt(int irq, void *dev_id);
 static int i596_close(struct net_device *dev);
 static struct net_device_stats *i596_get_stats(struct net_device *dev);
 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
@@ -445,7 +444,7 @@ static inline int wait_cmd(struct net_device *dev, struct i596_private *lp, int
 static inline int wait_cfg(struct net_device *dev, struct i596_cmd *cmd, int delcnt, char *str)
 {
        volatile struct i596_cmd *c = cmd;
-       
+
        while (--delcnt && c->command)
                udelay(10);
        if (!delcnt) {
@@ -456,7 +455,7 @@ static inline int wait_cfg(struct net_device *dev, struct i596_cmd *cmd, int del
                return 0;
 }
 
+
 static void i596_display_data(struct net_device *dev)
 {
        struct i596_private *lp = dev->priv;
@@ -502,7 +501,7 @@ static void i596_display_data(struct net_device *dev)
 
 
 #if defined(ENABLE_MVME16x_NET) || defined(ENABLE_BVME6000_NET)
-static irqreturn_t i596_error(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t i596_error(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
 #ifdef ENABLE_MVME16x_NET
@@ -546,11 +545,11 @@ static inline void init_rx_bufs(struct net_device *dev)
                rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1));
                rbd->b_addr = WSWAPrbd(virt_to_bus(rbd));
                rbd->skb = skb;
-               rbd->v_data = skb->tail;
-               rbd->b_data = WSWAPchar(virt_to_bus(skb->tail));
+               rbd->v_data = skb->data;
+               rbd->b_data = WSWAPchar(virt_to_bus(skb->data));
                rbd->size = PKT_BUF_SZ;
 #ifdef __mc68000__
-               cache_clear(virt_to_phys(skb->tail), PKT_BUF_SZ);
+               cache_clear(virt_to_phys(skb->data), PKT_BUF_SZ);
 #endif
        }
        lp->rbd_head = lp->rbds;
@@ -614,7 +613,7 @@ static void rebuild_rx_bufs(struct net_device *dev)
 static int init_i596_mem(struct net_device *dev)
 {
        struct i596_private *lp = dev->priv;
-#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET)
+#if !defined(ENABLE_MVME16x_NET) && !defined(ENABLE_BVME6000_NET) || defined(ENABLE_APRICOT)
        short ioaddr = dev->base_addr;
 #endif
        unsigned long flags;
@@ -788,7 +787,7 @@ static inline int i596_rx(struct net_device *dev)
                }
                DEB(DEB_RXFRAME, printk(KERN_DEBUG "  rfd %p, rfd.rbd %p, rfd.stat %04x\n",
                        rfd, rfd->rbd, rfd->stat));
-               
+
                if (rbd != I596_NULL && ((rfd->stat) & STAT_OK)) {
                        /* a good frame */
                        int pkt_len = rbd->count & 0x3fff;
@@ -816,10 +815,10 @@ static inline int i596_rx(struct net_device *dev)
                                rx_in_place = 1;
                                rbd->skb = newskb;
                                newskb->dev = dev;
-                               rbd->v_data = newskb->tail;
-                               rbd->b_data = WSWAPchar(virt_to_bus(newskb->tail));
+                               rbd->v_data = newskb->data;
+                               rbd->b_data = WSWAPchar(virt_to_bus(newskb->data));
 #ifdef __mc68000__
-                               cache_clear(virt_to_phys(newskb->tail), PKT_BUF_SZ);
+                               cache_clear(virt_to_phys(newskb->data), PKT_BUF_SZ);
 #endif
                        }
                        else
@@ -840,7 +839,7 @@ memory_squeeze:
                                skb->protocol=eth_type_trans(skb,dev);
                                skb->len = pkt_len;
 #ifdef __mc68000__
-                               cache_clear(virt_to_phys(rbd->skb->tail),
+                               cache_clear(virt_to_phys(rbd->skb->data),
                                                pkt_len);
 #endif
                                netif_rx(skb);
@@ -900,7 +899,7 @@ memory_squeeze:
 }
 
 
-static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp)
+static void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp)
 {
        struct i596_cmd *ptr;
 
@@ -933,7 +932,8 @@ static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private
        lp->scb.cmd = I596_NULL;
 }
 
-static inline void i596_reset(struct net_device *dev, struct i596_private *lp, int ioaddr)
+static void i596_reset(struct net_device *dev, struct i596_private *lp,
+                       int ioaddr)
 {
        unsigned long flags;
 
@@ -1066,12 +1066,11 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
        short length = skb->len;
        dev->trans_start = jiffies;
 
-       DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%x) called\n", dev->name,
-                               skb->len, (unsigned int)skb->data));
+       DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n",
+                               dev->name, skb->len, skb->data));
 
        if (skb->len < ETH_ZLEN) {
-               skb = skb_padto(skb, ETH_ZLEN);
-               if (skb == NULL)
+               if (skb_padto(skb, ETH_ZLEN))
                        return 0;
                length = ETH_ZLEN;
        }
@@ -1209,7 +1208,7 @@ struct net_device * __init i82596_probe(int unit)
                   Some other boards trip the checksum.. but then appear as
                   ether address 0. Trap these - AC */
 
-               if ((checksum % 0x100) || 
+               if ((checksum % 0x100) ||
                    (memcmp(eth_addr, "\x00\x00\x49", 3) != 0)) {
                        err = -ENODEV;
                        goto out1;
@@ -1247,7 +1246,8 @@ struct net_device * __init i82596_probe(int unit)
        dev->priv = (void *)(dev->mem_start);
 
        lp = dev->priv;
-       DEB(DEB_INIT,printk(KERN_DEBUG "%s: lp at 0x%08lx (%d bytes), lp->scb at 0x%08lx\n",
+       DEB(DEB_INIT,printk(KERN_DEBUG "%s: lp at 0x%08lx (%zd bytes), "
+                       "lp->scb at 0x%08lx\n",
                        dev->name, (unsigned long)lp,
                        sizeof(struct i596_private), (unsigned long)&lp->scb));
        memset((void *) lp, 0, sizeof(struct i596_private));
@@ -1260,7 +1260,7 @@ struct net_device * __init i82596_probe(int unit)
        lp->scb.command = 0;
        lp->scb.cmd = I596_NULL;
        lp->scb.rfd = I596_NULL;
-       lp->lock = SPIN_LOCK_UNLOCKED;
+       spin_lock_init(&lp->lock);
 
        err = register_netdev(dev);
        if (err)
@@ -1284,7 +1284,7 @@ out:
        return ERR_PTR(err);
 }
 
-static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t i596_interrupt(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct i596_private *lp;
@@ -1295,7 +1295,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 #ifdef ENABLE_BVME6000_NET
        if (MACH_IS_BVME6000) {
                if (*(char *) BVME_LOCAL_IRQ_STAT & BVME_ETHERR) {
-                       i596_error(irq, dev_id, regs);
+                       i596_error(irq, dev_id);
                        return IRQ_HANDLED;
                }
        }
@@ -1546,7 +1546,7 @@ static void set_multicast_list(struct net_device *dev)
                printk(KERN_ERR "%s: Only %d multicast addresses supported",
                        dev->name, cnt);
        }
-       
+
        if (dev->mc_count > 0) {
                struct dev_mc_list *dmi;
                unsigned char *cp;
@@ -1572,15 +1572,15 @@ static void set_multicast_list(struct net_device *dev)
 static struct net_device *dev_82596;
 
 #ifdef ENABLE_APRICOT
-MODULE_PARM(irq, "i");
+module_param(irq, int, 0);
 MODULE_PARM_DESC(irq, "Apricot IRQ number");
 #endif
 
-MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug, "i82596 debug mask");
 static int debug = -1;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, "i82596 debug mask");
 
-int init_module(void)
+int __init init_module(void)
 {
        if (debug >= 0)
                i596_debug = debug;
@@ -1590,7 +1590,7 @@ int init_module(void)
        return 0;
 }
 
-void cleanup_module(void)
+void __exit cleanup_module(void)
 {
        unregister_netdev(dev_82596);
 #ifdef __mc68000__
@@ -1610,7 +1610,7 @@ void cleanup_module(void)
 }
 
 #endif                         /* MODULE */
-\f
+
 /*
  * Local variables:
  *  compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c 82596.c"