X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2F82596.c;h=640d7ca2ebcff7bffb294fee0bf63b672578b5e9;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=92cf5e0d756ff95dbf62bce856fb16f6ace1f66a;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 92cf5e0d7..640d7ca2e 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c @@ -40,7 +40,6 @@ */ -#include #include #include #include @@ -53,16 +52,17 @@ #include #include #include +#include -#include #include #include #include -#include static char version[] __initdata = "82596.c $Revision: 1.5 $\n"; +#define DRV_NAME "82596" + /* DEBUG flags */ @@ -149,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"); @@ -357,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); @@ -444,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) { @@ -455,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; @@ -501,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 @@ -545,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; @@ -613,12 +613,12 @@ 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; - MPU_PORT(dev, PORT_RESET, 0); + MPU_PORT(dev, PORT_RESET, NULL); udelay(100); /* Wait 100us - seems to help */ @@ -759,7 +759,7 @@ static int init_i596_mem(struct net_device *dev) failed: printk(KERN_CRIT "%s: Failed to initialise 82596\n", dev->name); - MPU_PORT(dev, PORT_RESET, 0); + MPU_PORT(dev, PORT_RESET, NULL); return -1; } @@ -787,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; @@ -815,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 @@ -839,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); @@ -899,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; @@ -932,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; @@ -1065,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; } @@ -1191,7 +1191,7 @@ struct net_device * __init i82596_probe(int unit) /* this is easy the ethernet interface can only be at 0x300 */ /* first check nothing is already registered here */ - if (!request_region(ioaddr, I596_TOTAL_SIZE, dev->name)) { + if (!request_region(ioaddr, I596_TOTAL_SIZE, DRV_NAME)) { printk(KERN_ERR "82596: IO address 0x%04x in use\n", ioaddr); err = -EBUSY; goto out; @@ -1208,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; @@ -1246,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)); @@ -1259,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) @@ -1283,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; @@ -1294,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; } } @@ -1545,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; @@ -1571,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; @@ -1589,7 +1590,7 @@ int init_module(void) return 0; } -void cleanup_module(void) +void __exit cleanup_module(void) { unregister_netdev(dev_82596); #ifdef __mc68000__ @@ -1609,7 +1610,7 @@ void cleanup_module(void) } #endif /* MODULE */ - + /* * Local variables: * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/net/inet -Wall -Wstrict-prototypes -O6 -m486 -c 82596.c"