diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-20 20:41:10 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-04-20 20:41:10 -0700 |
| commit | f89168fe22d437521ed02f93c5fb1347a8cc4306 (patch) | |
| tree | 409bf330180a075f5946ce67ee677834a76b7b13 | |
| parent | ec9fc417f091337fdc5ba4d0059dff0bf58b9a27 (diff) | |
| parent | b6b44ebfa139b5de44257388a64b016860b3ec84 (diff) | |
Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
80 files changed, 482 insertions, 364 deletions
diff --git a/drivers/net/3c501.c b/drivers/net/3c501.c index 5dcceb8ad81d..c6fba9fbdd57 100644 --- a/drivers/net/3c501.c +++ b/drivers/net/3c501.c @@ -510,7 +510,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev) * TCP window. */ -static void el_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t el_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct net_local *lp; @@ -558,7 +558,7 @@ static void el_interrupt(int irq, void *dev_id, struct pt_regs *regs) } lp->loading=2; /* Force a reload */ spin_unlock(&lp->lock); - return; + goto out; } if (el_debug > 6) @@ -606,7 +606,7 @@ static void el_interrupt(int irq, void *dev_id, struct pt_regs *regs) outb(AX_XMIT, AX_CMD); lp->stats.collisions++; spin_unlock(&lp->lock); - return; + goto out; } else { @@ -675,7 +675,8 @@ static void el_interrupt(int irq, void *dev_id, struct pt_regs *regs) inb(RX_STATUS); /* Be certain that interrupts are cleared. */ inb(TX_STATUS); spin_unlock(&lp->lock); - return; +out: + return IRQ_HANDLED; } diff --git a/drivers/net/3c501.h b/drivers/net/3c501.h index e0c8a846848c..e4f34781b9ce 100644 --- a/drivers/net/3c501.h +++ b/drivers/net/3c501.h @@ -8,7 +8,7 @@ static int el1_probe1(struct net_device *dev, int ioaddr); static int el_open(struct net_device *dev); static void el_timeout(struct net_device *dev); static int el_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void el_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t el_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void el_receive(struct net_device *dev); static void el_reset(struct net_device *dev); static int el1_close(struct net_device *dev); diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 25f22cd89701..3112d5deac88 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -259,7 +259,7 @@ static inline unsigned int backlog_next(unsigned int n) static inline int get_status(unsigned int base_addr) { - int timeout = jiffies + 10*HZ/100; + unsigned long timeout = jiffies + 10*HZ/100; register int stat1; do { stat1 = inb_status(base_addr); @@ -283,7 +283,7 @@ static int start_receive(struct net_device *, pcb_struct *); inline static void adapter_reset(struct net_device *dev) { - int timeout; + unsigned long timeout; elp_device *adapter = dev->priv; unsigned char orig_hcr = adapter->hcr_val; @@ -343,7 +343,7 @@ static inline void check_3c505_dma(struct net_device *dev) /* Primitive functions used by send_pcb() */ static inline unsigned int send_pcb_slow(unsigned int base_addr, unsigned char byte) { - unsigned int timeout; + unsigned long timeout; outb_command(byte, base_addr); for (timeout = jiffies + 5*HZ/100; time_before(jiffies, timeout);) { if (inb_status(base_addr) & HCRE) @@ -402,7 +402,7 @@ static inline void prime_rx(struct net_device *dev) static int send_pcb(struct net_device *dev, pcb_struct * pcb) { int i; - int timeout; + unsigned long timeout; elp_device *adapter = dev->priv; unsigned long flags; @@ -488,7 +488,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb) int i, j; int total_length; int stat; - int timeout; + unsigned long timeout; unsigned long flags; elp_device *adapter = dev->priv; @@ -662,14 +662,14 @@ static void receive_packet(struct net_device *dev, int len) * ******************************************************/ -static void elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) +static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) { int len; int dlen; int icount = 0; struct net_device *dev; elp_device *adapter; - int timeout; + unsigned long timeout; dev = dev_id; adapter = (elp_device *) dev->priv; @@ -855,6 +855,7 @@ static void elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) * indicate no longer in interrupt routine */ spin_unlock(&adapter->lock); + return IRQ_HANDLED; } @@ -947,7 +948,7 @@ static int elp_open(struct net_device *dev) if (!send_pcb(dev, &adapter->tx_pcb)) printk("%s: couldn't send memory configuration command\n", dev->name); else { - int timeout = jiffies + TIMEOUT; + unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) TIMEOUT_MSG(__LINE__); @@ -966,7 +967,7 @@ static int elp_open(struct net_device *dev) if (!send_pcb(dev, &adapter->tx_pcb)) printk("%s: couldn't send 82586 configure command\n", dev->name); else { - int timeout = jiffies + TIMEOUT; + unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) TIMEOUT_MSG(__LINE__); @@ -1150,7 +1151,7 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev) if (!send_pcb(dev, &adapter->tx_pcb)) printk("%s: couldn't send get statistics command\n", dev->name); else { - int timeout = jiffies + TIMEOUT; + unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_NETWORK_STATISTICS] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) { TIMEOUT_MSG(__LINE__); @@ -1317,7 +1318,7 @@ static void elp_set_mc_list(struct net_device *dev) if (!send_pcb(dev, &adapter->tx_pcb)) printk("%s: couldn't send set_multicast command\n", dev->name); else { - int timeout = jiffies + TIMEOUT; + unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_LOAD_MULTICAST_LIST] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) { TIMEOUT_MSG(__LINE__); @@ -1344,7 +1345,7 @@ static void elp_set_mc_list(struct net_device *dev) printk("%s: couldn't send 82586 configure command\n", dev->name); } else { - int timeout = jiffies + TIMEOUT; + unsigned long timeout = jiffies + TIMEOUT; spin_unlock_irqrestore(&adapter->lock, flags); while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) @@ -1396,10 +1397,8 @@ static inline void elp_init(struct net_device *dev) static int __init elp_sense(struct net_device *dev) { - int timeout; int addr = dev->base_addr; const char *name = dev->name; - unsigned long flags; byte orig_HSR; if (!request_region(addr, ELP_IO_EXTENT, "3c505")) @@ -1506,7 +1505,8 @@ static int __init elp_autodetect(struct net_device *dev) int __init elplus_probe(struct net_device *dev) { elp_device *adapter; - int i, tries, tries1, timeout, okay; + int i, tries, tries1, okay; + unsigned long timeout; unsigned long cookie = 0; SET_MODULE_OWNER(dev); diff --git a/drivers/net/3c505.h b/drivers/net/3c505.h index 23714facc7fc..77dfeedff815 100644 --- a/drivers/net/3c505.h +++ b/drivers/net/3c505.h @@ -279,7 +279,7 @@ typedef struct { unsigned int length; struct sk_buff *skb; void *target; - long int start_time; + unsigned long start_time; } current_dma; /* flags */ diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index 4a365c19395b..3a7f8187c964 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c @@ -291,7 +291,7 @@ extern int el16_probe(struct net_device *dev); /* Called from Space.c */ static int el16_probe1(struct net_device *dev, int ioaddr); static int el16_open(struct net_device *dev); static int el16_send_packet(struct sk_buff *skb, struct net_device *dev); -static void el16_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void el16_rx(struct net_device *dev); static int el16_close(struct net_device *dev); static struct net_device_stats *el16_get_stats(struct net_device *dev); @@ -516,7 +516,7 @@ static int el16_send_packet (struct sk_buff *skb, struct net_device *dev) /* The typical workload of the driver: Handle the network interface interrupts. */ -static void el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct net_local *lp; @@ -526,7 +526,7 @@ static void el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (dev == NULL) { printk ("net_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; @@ -616,6 +616,7 @@ static void el16_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* Enable the 82586's interrupt input. */ outb(0x84, ioaddr + MISC_CTRL); spin_unlock(&lp->lock); + return IRQ_HANDLED; } static int el16_close(struct net_device *dev) diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c index 61cde566fcb3..64be3510c773 100644 --- a/drivers/net/3c509.c +++ b/drivers/net/3c509.c @@ -192,7 +192,7 @@ static ushort id_read_eeprom(int index); static ushort read_eeprom(int ioaddr, int index); static int el3_open(struct net_device *dev); static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void el3_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t el3_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void update_stats(struct net_device *dev); static struct net_device_stats *el3_get_stats(struct net_device *dev); static int el3_rx(struct net_device *dev); @@ -882,7 +882,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev) } /* The EL3 interrupt handler. */ -static void +static irqreturn_t el3_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; @@ -892,7 +892,7 @@ el3_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (dev == NULL) { printk ("el3_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } lp = (struct el3_private *)dev->priv; @@ -967,7 +967,7 @@ el3_interrupt(int irq, void *dev_id, struct pt_regs *regs) inw(ioaddr + EL3_STATUS)); } spin_unlock(&lp->lock); - return; + return IRQ_HANDLED; } diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c index 74b275e5a0b3..c7214a926788 100644 --- a/drivers/net/3c515.c +++ b/drivers/net/3c515.c @@ -1,4 +1,3 @@ - /* Written 1997-1998 by Donald Becker. @@ -387,7 +386,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb, static int corkscrew_rx(struct net_device *dev); static void corkscrew_timeout(struct net_device *dev); static int boomerang_rx(struct net_device *dev); -static void corkscrew_interrupt(int irq, void *dev_id, +static irqreturn_t corkscrew_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int corkscrew_close(struct net_device *dev); static void update_stats(int addr, struct net_device *dev); @@ -1150,7 +1149,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb, /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void corkscrew_interrupt(int irq, void *dev_id, +static irqreturn_t corkscrew_interrupt(int irq, void *dev_id, struct pt_regs *regs) { /* Use the now-standard shared IRQ implementation. */ @@ -1289,6 +1288,7 @@ static void corkscrew_interrupt(int irq, void *dev_id, if (corkscrew_debug > 4) printk("%s: exiting interrupt, status %4.4x.\n", dev->name, status); + return IRQ_HANDLED; } static int corkscrew_rx(struct net_device *dev) diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 1db511eac158..7eb3df17ebf5 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -885,8 +885,8 @@ static int vortex_start_xmit(struct sk_buff *skb, struct net_device *dev); static int boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev); static int vortex_rx(struct net_device *dev); static int boomerang_rx(struct net_device *dev); -static void vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs); -static void boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int vortex_close(struct net_device *dev); static void dump_tx_ring(struct net_device *dev); static void update_stats(long ioaddr, struct net_device *dev); @@ -2208,14 +2208,16 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) * full_bus_master_tx == 0 && full_bus_master_rx == 0 */ -static void vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t +vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct vortex_private *vp = (struct vortex_private *)dev->priv; long ioaddr; int status; int work_done = max_interrupt_work; - + int handled = 0; + ioaddr = dev->base_addr; spin_lock(&vp->lock); @@ -2226,6 +2228,7 @@ static void vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs) if ((status & IntLatch) == 0) goto handler_exit; /* No interrupt: shared IRQs cause this */ + handled = 1; if (status & IntReq) { status |= vp->deferred; @@ -2302,6 +2305,7 @@ static void vortex_interrupt(int irq, void *dev_id, struct pt_regs *regs) dev->name, status); handler_exit: spin_unlock(&vp->lock); + return IRQ_RETVAL(handled); } /* @@ -2309,13 +2313,15 @@ handler_exit: * full_bus_master_tx == 1 && full_bus_master_rx == 1 */ -static void boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t +boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct vortex_private *vp = (struct vortex_private *)dev->priv; long ioaddr; int status; int work_done = max_interrupt_work; + int handled; ioaddr = dev->base_addr; @@ -2330,14 +2336,18 @@ static void boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (vortex_debug > 6) printk(KERN_DEBUG "boomerang_interrupt. status=0x%4x\n", status); - if ((status & IntLatch) == 0) + if ((status & IntLatch) == 0) { + handled = 0; goto handler_exit; /* No interrupt: shared IRQs can cause this */ + } if (status == 0xffff) { /* h/w no longer present (hotplug)? */ if (vortex_debug > 1) printk(KERN_DEBUG "boomerang_interrupt(1): status = 0xffff\n"); + handled = 0; goto handler_exit; } + handled = 1; if (status & IntReq) { status |= vp->deferred; @@ -2432,6 +2442,7 @@ static void boomerang_interrupt(int irq, void *dev_id, struct pt_regs *regs) dev->name, status); handler_exit: spin_unlock(&vp->lock); + return IRQ_RETVAL(handled); } static int vortex_rx(struct net_device *dev) diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index 5bc9fe749d83..3e5e8572f3e2 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c @@ -658,7 +658,8 @@ rx_next: cp->rx_tail = rx_tail; } -static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t +cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = dev_instance; struct cp_private *cp = dev->priv; @@ -666,7 +667,7 @@ static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs) status = cpr16(IntrStatus); if (!status || (status == 0xFFFF)) - return; + return IRQ_NONE; if (netif_msg_intr(cp)) printk(KERN_DEBUG "%s: intr, status %04x cmd %02x cpcmd %04x\n", @@ -693,6 +694,7 @@ static void cp_interrupt (int irq, void *dev_instance, struct pt_regs *regs) } spin_unlock(&cp->lock); + return IRQ_HANDLED; } static void cp_tx (struct cp_private *cp) diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index a846aa9ea76c..a730ebf418ab 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c @@ -615,7 +615,7 @@ static void rtl8139_tx_timeout (struct net_device *dev); static void rtl8139_init_ring (struct net_device *dev); static int rtl8139_start_xmit (struct sk_buff *skb, struct net_device *dev); -static void rtl8139_interrupt (int irq, void *dev_instance, +static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance, struct pt_regs *regs); static int rtl8139_close (struct net_device *dev); static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd); @@ -2029,7 +2029,7 @@ static void rtl8139_weird_interrupt (struct net_device *dev, /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void rtl8139_interrupt (int irq, void *dev_instance, +static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_instance; @@ -2038,6 +2038,7 @@ static void rtl8139_interrupt (int irq, void *dev_instance, void *ioaddr = tp->mmio_addr; int ackstat, status; int link_changed = 0; /* avoid bogus "uninit" warning */ + int handled = 0; spin_lock (&tp->lock); @@ -2053,6 +2054,8 @@ static void rtl8139_interrupt (int irq, void *dev_instance, RxFIFOOver | TxErr | TxOK | RxErr | RxOK)) == 0) break; + handled = 1; + /* Acknowledge all of the current interrupt sources ASAP, but an first get an additional status bit from CSCR. */ if (status & RxUnderrun) @@ -2097,6 +2100,7 @@ static void rtl8139_interrupt (int irq, void *dev_instance, DPRINTK ("%s: exiting interrupt, intr_status=%#4.4x.\n", dev->name, RTL_R16 (IntrStatus)); + return IRQ_RETVAL(handled); } diff --git a/drivers/net/82596.c b/drivers/net/82596.c index 28001ae6c1b3..67e6f30f8c4c 100644 --- a/drivers/net/82596.c +++ b/drivers/net/82596.c @@ -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 void i596_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs); 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); @@ -1018,8 +1018,6 @@ static int i596_open(struct net_device *dev) netif_start_queue(dev); - MOD_INC_USE_COUNT; - /* Initialize the 82596 memory */ if (init_i596_mem(dev)) { res = -EAGAIN; @@ -1218,6 +1216,7 @@ int __init i82596_probe(struct net_device *dev) DEB(DEB_PROBE,printk(KERN_INFO "%s", version)); /* The 82596-specific entries in the device structure. */ + SET_MODULE_OWNER(dev); dev->open = i596_open; dev->stop = i596_close; dev->hard_start_xmit = i596_start_xmit; @@ -1247,24 +1246,25 @@ int __init i82596_probe(struct net_device *dev) return 0; } -static void i596_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct i596_private *lp; short ioaddr; unsigned short status, ack_cmd = 0; + int handled = 0; #ifdef ENABLE_BVME6000_NET if (MACH_IS_BVME6000) { if (*(char *) BVME_LOCAL_IRQ_STAT & BVME_ETHERR) { i596_error(irq, dev_id, regs); - return; + return IRQ_HANDLED; } } #endif if (dev == NULL) { printk(KERN_ERR "i596_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; @@ -1283,6 +1283,7 @@ static void i596_interrupt(int irq, void *dev_id, struct pt_regs *regs) if ((status & 0x8000) || (status & 0x2000)) { struct i596_cmd *ptr; + handled = 1; if ((status & 0x8000)) DEB(DEB_INTS,printk(KERN_DEBUG "%s: i596 interrupt completed command.\n", dev->name)); if ((status & 0x2000)) @@ -1405,7 +1406,7 @@ static void i596_interrupt(int irq, void *dev_id, struct pt_regs *regs) DEB(DEB_INTS,printk(KERN_DEBUG "%s: exiting interrupt.\n", dev->name)); spin_unlock (&lp->lock); - return; + return IRQ_RETVAL(handled); } static int i596_close(struct net_device *dev) @@ -1450,7 +1451,6 @@ static int i596_close(struct net_device *dev) free_irq(dev->irq, dev); remove_rx_bufs(dev); - MOD_DEC_USE_COUNT; return 0; } diff --git a/drivers/net/8390.c b/drivers/net/8390.c index 37c417e3f7ce..8aa6f58bdd3c 100644 --- a/drivers/net/8390.c +++ b/drivers/net/8390.c @@ -421,7 +421,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) * needed. */ -void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) +irqreturn_t ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; long e8390_base; @@ -431,7 +431,7 @@ void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) if (dev == NULL) { printk ("net_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } e8390_base = dev->base_addr; @@ -454,7 +454,7 @@ void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) inb_p(e8390_base + EN0_IMR)); #endif spin_unlock(&ei_local->page_lock); - return; + return IRQ_NONE; } /* Change to page 0 and read the intr status reg. */ @@ -520,7 +520,7 @@ void ei_interrupt(int irq, void *dev_id, struct pt_regs * regs) } } spin_unlock(&ei_local->page_lock); - return; + return IRQ_HANDLED; } /** diff --git a/drivers/net/8390.h b/drivers/net/8390.h index b9a61079dc5d..c6a53e910187 100644 --- a/drivers/net/8390.h +++ b/drivers/net/8390.h @@ -43,7 +43,7 @@ extern int ethdev_init(struct net_device *dev); extern void NS8390_init(struct net_device *dev, int startp); extern int ei_open(struct net_device *dev); extern int ei_close(struct net_device *dev); -extern void ei_interrupt(int irq, void *dev_id, struct pt_regs *regs); +extern irqreturn_t ei_interrupt(int irq, void *dev_id, struct pt_regs *regs); /* You have one of these per-board */ struct ei_device { diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c index 93fc9f2e86c2..b2d4ac676b9e 100755 --- a/drivers/net/amd8111e.c +++ b/drivers/net/amd8111e.c @@ -780,16 +780,18 @@ static struct net_device_stats *amd8111e_get_stats(struct net_device * dev) /* This is device interrupt function. It handles transmit, receive and link change interrupts. */ -static void amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t +amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device * dev = (struct net_device *) dev_id; struct amd8111e_priv *lp = dev->priv; void * mmio = lp->mmio; unsigned int intr0; + int handled = 0; if(dev == NULL) - return; + return IRQ_NONE; spin_lock (&lp->lock); /* disabling interrupt */ @@ -802,7 +804,8 @@ static void amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (!(intr0 & INTR)) goto err_no_interrupt; - + + handled = 1; /* Current driver processes 3 interrupts : RINT,TINT,LCINT */ writel(intr0, mmio + INT0); @@ -823,7 +826,7 @@ static void amd8111e_interrupt(int irq, void *dev_id, struct pt_regs *regs) err_no_interrupt: writel( VAL0 | INTREN,mmio + CMD0); spin_unlock(&lp->lock); - return; + return IRQ_RETVAL(handled); } /* diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c index d98c1e8f55bd..8a5d32152cf9 100644 --- a/drivers/net/at1700.c +++ b/drivers/net/at1700.c @@ -202,7 +202,7 @@ static int at1700_probe1(struct net_device *dev, int ioaddr); static int read_eeprom(long ioaddr, int location); static int net_open(struct net_device *dev); static int net_send_packet(struct sk_buff *skb, struct net_device *dev); -static void net_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void net_rx(struct net_device *dev); static int net_close(struct net_device *dev); static struct net_device_stats *net_get_stats(struct net_device *dev); @@ -696,16 +696,17 @@ static int net_send_packet (struct sk_buff *skb, struct net_device *dev) /* The typical workload of the driver: Handle the network interface interrupts. */ -static void +static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct net_local *lp; int ioaddr, status; + int handled = 0; if (dev == NULL) { printk ("at1700_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; @@ -726,6 +727,7 @@ net_interrupt(int irq, void *dev_id, struct pt_regs *regs) Tx interrupt. Thus we flag on rx_started, so that we prevent the interrupt routine (net_interrupt) to dive into net_rx again. */ + handled = 1; lp->rx_started = 1; outb(0x00, ioaddr + RX_INTR); /* Disable RX intr. */ net_rx(dev); @@ -733,6 +735,7 @@ net_interrupt(int irq, void *dev_id, struct pt_regs *regs) lp->rx_started = 0; } if (status & 0x00ff) { + handled = 1; if (status & 0x02) { /* More than 16 collisions occurred */ if (net_debug > 4) @@ -760,7 +763,7 @@ net_interrupt(int irq, void *dev_id, struct pt_regs *regs) } spin_unlock (&lp->lock); - return; + return IRQ_RETVAL(handled); } /* We have a good packet(s), get it/them out of the buffers. */ @@ -914,9 +917,11 @@ set_rx_mode(struct net_device *dev) memset(mc_filter, 0, sizeof(mc_filter)); for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist = mclist->next) - set_bit(ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26, - mc_filter); + i++, mclist = mclist->next) { + unsigned int bit = + ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26; + mc_filter[bit >> 3] |= (1 << bit); + } outb(0x02, ioaddr + RX_MODE); /* Use normal mode. */ } diff --git a/drivers/net/atp.c b/drivers/net/atp.c index 2deac9a550f3..e22e5553779e 100644 --- a/drivers/net/atp.c +++ b/drivers/net/atp.c @@ -203,7 +203,7 @@ static void hardware_init(struct net_device *dev); static void write_packet(long ioaddr, int length, unsigned char *packet, int pad, int mode); static void trigger_send(long ioaddr, int length); static int atp_send_packet(struct sk_buff *skb, struct net_device *dev); -static void atp_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t atp_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void net_rx(struct net_device *dev); static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode); static int net_close(struct net_device *dev); @@ -560,7 +560,7 @@ static int atp_send_packet(struct sk_buff *skb, struct net_device *dev) struct net_local *lp = (struct net_local *)dev->priv; long ioaddr = dev->base_addr; int length; - long flags; + unsigned long flags; length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; @@ -596,17 +596,19 @@ static int atp_send_packet(struct sk_buff *skb, struct net_device *dev) /* The typical workload of the driver: Handle the network interface interrupts. */ -static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) +static irqreturn_t +atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) { struct net_device *dev = (struct net_device *)dev_instance; struct net_local *lp; long ioaddr; static int num_tx_since_rx; int boguscount = max_interrupt_work; + int handled = 0; if (dev == NULL) { printk(KERN_ERR "ATP_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; lp = (struct net_local *)dev->priv; @@ -626,6 +628,7 @@ static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) if (net_debug > 5) printk("loop status %02x..", status); if (status & (ISR_RxOK<<3)) { + handled = 1; write_reg(ioaddr, ISR, ISR_RxOK); /* Clear the Rx interrupt. */ do { int read_status = read_nibble(ioaddr, CMR1); @@ -648,6 +651,7 @@ static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) break; } while (--boguscount > 0); } else if (status & ((ISR_TxErr + ISR_TxOK)<<3)) { + handled = 1; if (net_debug > 6) printk("handling Tx done.."); /* Clear the Tx interrupt. We should check for too many failures and reinitialize the adapter. */ @@ -712,7 +716,7 @@ static void atp_interrupt(int irq, void *dev_instance, struct pt_regs * regs) spin_unlock(&lp->lock); if (net_debug > 5) printk("exiting interrupt.\n"); - return; + return IRQ_RETVAL(handled); } #ifdef TIMED_CHECKER diff --git a/drivers/net/b44.c b/drivers/net/b44.c index f9847f4c2b41..3b7d0f98f418 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -799,12 +799,13 @@ static int b44_poll(struct net_device *netdev, int *budget) return (done ? 0 : 1); } -static void b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct b44 *bp = dev->priv; unsigned long flags; u32 istat, imask; + int handled = 0; spin_lock_irqsave(&bp->lock, flags); @@ -816,6 +817,7 @@ static void b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) */ istat &= imask; if (istat) { + handled = 1; if (netif_rx_schedule_prep(dev)) { /* NOTE: These writes are posted by the readback of * the ISTAT register below. @@ -832,6 +834,7 @@ static void b44_interrupt(int irq, void *dev_id, struct pt_regs *regs) br32(B44_ISTAT); } spin_unlock_irqrestore(&bp->lock, flags); + return IRQ_RETVAL(handled); } static void b44_tx_timeout(struct net_device *dev) diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 7cdac3742f8f..a809d430e004 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c @@ -218,7 +218,7 @@ extern int cs89x0_probe(struct net_device *dev); static int cs89x0_probe1(struct net_device *dev, int ioaddr); static int net_open(struct net_device *dev); static int net_send_packet(struct sk_buff *skb, struct net_device *dev); -static void net_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void set_multicast_list(struct net_device *dev); static void net_timeout(struct net_device *dev); static void net_rx(struct net_device *dev); @@ -1401,12 +1401,13 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev) /* The typical workload of the driver: Handle the network interface interrupts. */ -static void net_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static irqreturn_t net_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; struct net_local *lp; int ioaddr, status; - + int handled = 0; + ioaddr = dev->base_addr; lp = (struct net_local *)dev->priv; @@ -1419,6 +1420,7 @@ static void net_interrupt(int irq, void *dev_id, struct pt_regs * regs) vista, baby! */ while ((status = readword(dev, ISQ_PORT))) { if (net_debug > 4)printk("%s: event=%04x\n", dev->name, status); + handled = 1; switch(status & ISQ_EVENT_MASK) { case ISQ_RECEIVER_EVENT: /* Got a packet(s). */ @@ -1485,6 +1487,7 @@ static void net_interrupt(int irq, void *dev_id, struct pt_regs * regs) break; } } + return IRQ_RETVAL(handled); } static void diff --git a/drivers/net/de600.c b/drivers/net/de600.c index 23d87e5f185e..62c70b45e555 100644 --- a/drivers/net/de600.c +++ b/drivers/net/de600.c @@ -258,7 +258,7 @@ static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev) * Handle the network interface interrupts. */ -static void de600_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static irqreturn_t de600_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; u8 irq_status; @@ -268,7 +268,7 @@ static void de600_interrupt(int irq, void *dev_id, struct pt_regs * regs) /* This might just as well be deleted now, no crummy drivers present :-) */ if ((dev == NULL) || (DE600_IRQ != irq)) { printk(KERN_ERR "%s: bogus interrupt %d\n", dev?dev->name:"DE-600", irq); - return; + return IRQ_NONE; } spin_lock(&de600_lock); @@ -303,7 +303,7 @@ static void de600_interrupt(int irq, void *dev_id, struct pt_regs * regs) if (retrig) trigger_interrupt(dev); spin_unlock(&de600_lock); - return; + return IRQ_HANDLED; } static int de600_tx_intr(struct net_device *dev, int irq_status) diff --git a/drivers/net/de600.h b/drivers/net/de600.h index 3bbc770904c4..269aa4b61fbb 100644 --- a/drivers/net/de600.h +++ b/drivers/net/de600.h @@ -125,7 +125,7 @@ static struct net_device_stats *get_stats(struct net_device *dev); static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev); /* Dispatch from interrupts. */ -static void de600_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t de600_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int de600_tx_intr(struct net_device *dev, int irq_status); static void de600_rx_intr(struct net_device *dev); diff --git a/drivers/net/de620.c b/drivers/net/de620.c index 1ad20c3313e6..2c24105028cd 100644 --- a/drivers/net/de620.c +++ b/drivers/net/de620.c @@ -221,7 +221,7 @@ static void de620_set_multicast_list(struct net_device *); static int de620_start_xmit(struct sk_buff *, struct net_device *); /* Dispatch from interrupts. */ -static void de620_interrupt(int, void *, struct pt_regs *); +static irqreturn_t de620_interrupt(int, void *, struct pt_regs *); static int de620_rx_intr(struct net_device *); /* Initialization */ @@ -591,7 +591,8 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev) * Handle the network interface interrupts. * */ -static void de620_interrupt(int irq_in, void *dev_id, struct pt_regs *regs) +static irqreturn_t +de620_interrupt(int irq_in, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; byte irq_status; @@ -617,6 +618,7 @@ static void de620_interrupt(int irq_in, void *dev_id, struct pt_regs *regs) netif_wake_queue(dev); spin_unlock(&de620_lock); + return IRQ_HANDLED; } /************************************** diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 8a06665aedc6..fd92339319a3 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c @@ -430,7 +430,7 @@ struct depca_private { */ static int depca_open(struct net_device *dev); static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int depca_close(struct net_device *dev); static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static void depca_tx_timeout(struct net_device *dev); @@ -894,7 +894,7 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev) /* ** The DEPCA interrupt handler. */ -static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct depca_private *lp; @@ -903,7 +903,7 @@ static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (dev == NULL) { printk("depca_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } lp = (struct depca_private *) dev->priv; @@ -938,6 +938,7 @@ static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs) outb(nicsr, DEPCA_NICSR); spin_unlock(&lp->lock); + return IRQ_HANDLED; } /* Called with lp->lock held */ diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 843365663bcd..2882696fdd71 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c @@ -888,7 +888,7 @@ static int dgrs_ioctl(struct net_device *devN, struct ifreq *ifr, int cmd) * dev, priv will always refer to the 0th device in Multi-NIC mode. */ -static void dgrs_intr(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t dgrs_intr(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev0 = (struct net_device *) dev_id; DGRS_PRIV *priv0 = (DGRS_PRIV *) dev0->priv; @@ -971,6 +971,8 @@ static void dgrs_intr(int irq, void *dev_id, struct pt_regs *regs) ack_intr: if (priv0->plxreg) OUTL(dev0->base_addr + PLX_LCL2PCI_DOORBELL, 1); + + return IRQ_HANDLED; } /* diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 37ce2728ce0f..015ab57e202b 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c @@ -98,7 +98,7 @@ static void rio_timer (unsigned long data); static void rio_tx_timeout (struct net_device *dev); static void alloc_list (struct net_device *dev); static int start_xmit (struct sk_buff *skb, struct net_device *dev); -static void rio_interrupt (int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t rio_interrupt (int irq, void *dev_instance, struct pt_regs *regs); static void rio_free_tx (struct net_device *dev, int irq); static void tx_error (struct net_device *dev, int tx_status); static int receive_packet (struct net_device *dev); @@ -699,7 +699,7 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) return 0; } -static void +static irqreturn_t rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = dev_instance; @@ -707,6 +707,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) unsigned int_status; long ioaddr; int cnt = max_intrloop; + int handled = 0; ioaddr = dev->base_addr; np = dev->priv; @@ -716,6 +717,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) int_status &= DEFAULT_INTR; if (int_status == 0 || --cnt < 0) break; + handled = 1; /* Processing received packets */ if (int_status & RxDMAComplete) receive_packet (dev); @@ -736,6 +738,7 @@ rio_interrupt (int irq, void *dev_instance, struct pt_regs *rgs) } if (np->cur_tx != np->old_tx) writel (100, ioaddr + CountDown); + return IRQ_RETVAL(handled); } static void @@ -744,7 +747,7 @@ rio_free_tx (struct net_device *dev, int irq) struct netdev_private *np = (struct netdev_private *) dev->priv; int entry = np->old_tx % TX_RING_SIZE; int tx_use = 0; - long flag = 0; + unsigned long flag = 0; if (irq) spin_lock(&np->tx_lock); diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index fd5de8f28de4..d0fcc2491cfe 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c @@ -154,7 +154,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p); static void e1000_update_stats(struct e1000_adapter *adapter); static inline void e1000_irq_disable(struct e1000_adapter *adapter); static inline void e1000_irq_enable(struct e1000_adapter *adapter); -static void e1000_intr(int irq, void *data, struct pt_regs *regs); +static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs); #ifdef CONFIG_E1000_NAPI static int e1000_clean(struct net_device *netdev, int *budget); static boolean_t e1000_clean_rx_irq(struct e1000_adapter *adapter, @@ -1981,7 +1981,7 @@ e1000_irq_enable(struct e1000_adapter *adapter) * @pt_regs: CPU registers structure **/ -static void +static irqreturn_t e1000_intr(int irq, void *data, struct pt_regs *regs) { struct net_device *netdev = data; @@ -1992,7 +1992,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) #endif if(!icr) - return; /* Not our interrupt */ + return IRQ_NONE; /* Not our interrupt */ if(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { adapter->hw.get_link_status = 1; @@ -2016,6 +2016,7 @@ e1000_intr(int irq, void *data, struct pt_regs *regs) !e1000_clean_tx_irq(adapter)) break; #endif + return IRQ_HANDLED; } #ifdef CONFIG_E1000_NAPI diff --git a/drivers/net/eepro.c b/drivers/net/eepro.c index 59b6945f4baa..a868d3abbe22 100644 --- a/drivers/net/eepro.c +++ b/drivers/net/eepro.c @@ -307,7 +307,7 @@ extern int eepro_probe(struct net_device *dev); static int eepro_probe1(struct net_device *dev, short ioaddr); static int eepro_open(struct net_device *dev); static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev); -static void eepro_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t eepro_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void eepro_rx(struct net_device *dev); static void eepro_transmit_interrupt(struct net_device *dev); static int eepro_close(struct net_device *dev); @@ -1104,8 +1104,6 @@ static int eepro_open(struct net_device *dev) /* enabling rx */ eepro_en_rx(ioaddr); - MOD_INC_USE_COUNT; - return 0; } @@ -1178,17 +1176,18 @@ static int eepro_send_packet(struct sk_buff *skb, struct net_device *dev) /* The typical workload of the driver: Handle the network interface interrupts. */ -static void +static irqreturn_t eepro_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = (struct net_device *)dev_id; /* (struct net_device *)(irq2dev_map[irq]);*/ struct eepro_local *lp; int ioaddr, status, boguscount = 20; + int handled = 0; if (dev == NULL) { printk (KERN_ERR "eepro_interrupt(): irq %d for unknown device.\\n", irq); - return; + return IRQ_NONE; } lp = (struct eepro_local *)dev->priv; @@ -1202,6 +1201,7 @@ eepro_interrupt(int irq, void *dev_id, struct pt_regs * regs) while (((status = inb(ioaddr + STATUS_REG)) & (RX_INT|TX_INT)) && (boguscount--)) { + handled = 1; if (status & RX_INT) { if (net_debug > 4) printk(KERN_DEBUG "%s: packet received interrupt.\n", dev->name); @@ -1233,7 +1233,7 @@ eepro_interrupt(int irq, void *dev_id, struct pt_regs * regs) printk(KERN_DEBUG "%s: exiting eepro_interrupt routine.\n", dev->name); spin_unlock(&lp->lock); - return; + return IRQ_RETVAL(handled); } static int eepro_close(struct net_device *dev) @@ -1275,8 +1275,6 @@ static int eepro_close(struct net_device *dev) /* Update the statistics here. What statistics? */ - MOD_DEC_USE_COUNT; - return 0; } diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c index 7281b37026c9..076682df1638 100644 --- a/drivers/net/eepro100.c +++ b/drivers/net/eepro100.c @@ -541,7 +541,7 @@ static int speedo_start_xmit(struct sk_buff *skb, struct net_device *dev); static void speedo_refill_rx_buffers(struct net_device *dev, int force); static int speedo_rx(struct net_device *dev); static void speedo_tx_buffer_gc(struct net_device *dev); -static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int speedo_close(struct net_device *dev); static struct net_device_stats *speedo_get_stats(struct net_device *dev); static int speedo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); @@ -1560,12 +1560,13 @@ static void speedo_tx_buffer_gc(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_instance; struct speedo_private *sp; long ioaddr, boguscnt = max_interrupt_work; unsigned short status; + unsigned int handled = 0; ioaddr = dev->base_addr; sp = (struct speedo_private *)dev->priv; @@ -1576,7 +1577,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) printk(KERN_ERR"%s: SMP simultaneous entry of an interrupt handler.\n", dev->name); sp->in_interrupt = 0; /* Avoid halting machine. */ - return; + return IRQ_NONE; } #endif @@ -1593,6 +1594,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if ((status & 0xfc00) == 0) break; + handled = 1; if ((status & 0x5000) || /* Packet received, or Rx error. */ @@ -1654,7 +1656,7 @@ static void speedo_interrupt(int irq, void *dev_instance, struct pt_regs *regs) dev->name, inw(ioaddr + SCBStatus)); clear_bit(0, (void*)&sp->in_interrupt); - return; + return IRQ_RETVAL(handled); } static inline struct RxFD *speedo_rx_alloc(struct net_device *dev, int entry) diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 675430afd4a3..806ad0377d73 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c @@ -252,7 +252,7 @@ static void eexp_timeout(struct net_device *dev); static struct net_device_stats *eexp_stats(struct net_device *dev); static int eexp_xmit(struct sk_buff *buf, struct net_device *dev); -static void eexp_irq(int irq, void *dev_addr, struct pt_regs *regs); +static irqreturn_t eexp_irq(int irq, void *dev_addr, struct pt_regs *regs); static void eexp_set_multicast(struct net_device *dev); /* @@ -761,7 +761,7 @@ static void eexp_cmd_clear(struct net_device *dev) } } -static void eexp_irq(int irq, void *dev_info, struct pt_regs *regs) +static irqreturn_t eexp_irq(int irq, void *dev_info, struct pt_regs *regs) { struct net_device *dev = dev_info; struct net_local *lp; @@ -772,7 +772,7 @@ static void eexp_irq(int irq, void *dev_info, struct pt_regs *regs) { printk(KERN_WARNING "eexpress: irq %d for unknown device\n", irq); - return; + return IRQ_NONE; } lp = (struct net_local *)dev->priv; @@ -860,7 +860,7 @@ static void eexp_irq(int irq, void *dev_info, struct pt_regs *regs) outw(old_write_ptr, ioaddr+WRITE_PTR); spin_unlock(&lp->lock); - return; + return IRQ_HANDLED; } /* diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 557e351424cd..50982eca1dcb 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c @@ -360,7 +360,7 @@ static void epic_tx_timeout(struct net_device *dev); static void epic_init_ring(struct net_device *dev); static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev); static int epic_rx(struct net_device *dev); -static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); static int epic_close(struct net_device *dev); static struct net_device_stats *epic_get_stats(struct net_device *dev); @@ -973,7 +973,7 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) struct epic_private *ep = dev->priv; int entry, free_count; u32 ctrl_word; - long flags; + unsigned long flags; if (skb->len < ETH_ZLEN) { skb = skb_padto(skb, ETH_ZLEN); @@ -1028,12 +1028,13 @@ static int epic_start_xmit(struct sk_buff *skb, struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = dev_instance; struct epic_private *ep = dev->priv; long ioaddr = dev->base_addr; int status, boguscnt = max_interrupt_work; + unsigned int handled = 0; do { status = inl(ioaddr + INTSTAT); @@ -1047,6 +1048,7 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if ((status & IntrSummary) == 0) break; + handled = 1; if (status & (RxDone | RxStarted | RxEarlyWarn | RxOverflow)) epic_rx(dev); @@ -1156,7 +1158,7 @@ static void epic_interrupt(int irq, void *dev_instance, struct pt_regs *regs) printk(KERN_DEBUG "%s: exiting interrupt, intr_status=%#4.4x.\n", dev->name, status); - return; + return IRQ_RETVAL(handled); } static int epic_rx(struct net_device *dev) @@ -1343,9 +1345,11 @@ static void set_rx_mode(struct net_device *dev) memset(mc_filter, 0, sizeof(mc_filter)); for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist = mclist->next) - set_bit(ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f, - mc_filter); + i++, mclist = mclist->next) { + unsigned int bit_nr = + ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f; + mc_filter[bit_nr >> 3] |= (1 << bit_nr); + } } /* ToDo: perhaps we need to stop the Tx and Rx process here? */ if (memcmp(mc_filter, ep->mc_filter, sizeof(mc_filter))) { diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 867641422de1..824f1d48fe88 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c @@ -438,7 +438,7 @@ static void netdev_timer(unsigned long data); 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 void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); static int netdev_rx(struct net_device *dev); static void set_rx_mode(struct net_device *dev); static struct net_device_stats *get_stats(struct net_device *dev); @@ -1412,12 +1412,13 @@ void reset_rx_descriptors(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *) dev_instance; struct netdev_private *np = dev->priv; long ioaddr, boguscnt = max_interrupt_work; unsigned int num_tx = 0; + int handled = 0; writel(0, dev->base_addr + IMR); @@ -1437,6 +1438,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (!(intr_status & np->imrvalue)) break; + handled = 1; + // 90/1/16 delete, // // if (intr_status & FBE) @@ -1559,7 +1562,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) writel(np->imrvalue, ioaddr + IMR); - return; + return IRQ_RETVAL(handled); } @@ -1739,8 +1742,9 @@ static void set_rx_mode(struct net_device *dev) memset(mc_filter, 0, sizeof(mc_filter)); for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; i++, mclist = mclist->next) { - set_bit((ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F, - mc_filter); + unsigned int bit; + bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F; + mc_filter[bit >> 5] |= (1 << bit); } rx_mode = AB | AM; } diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 64e247a7338f..f9539782e679 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c @@ -558,7 +558,7 @@ static void hamachi_timer(unsigned long data); static void hamachi_tx_timeout(struct net_device *dev); static void hamachi_init_ring(struct net_device *dev); static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static inline int hamachi_rx(struct net_device *dev); static inline int hamachi_tx(struct net_device *dev); static void hamachi_error(struct net_device *dev, int intr_status); @@ -1367,16 +1367,17 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = dev_instance; struct hamachi_private *hmp; long ioaddr, boguscnt = max_interrupt_work; + int handled = 0; #ifndef final_version /* Can never occur. */ if (dev == NULL) { printk (KERN_ERR "hamachi_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } #endif @@ -1394,6 +1395,8 @@ static void hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) if (intr_status == 0) break; + handled = 1; + if (intr_status & IntrRxDone) hamachi_rx(dev); @@ -1466,6 +1469,7 @@ static void hamachi_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) #endif spin_unlock(&hmp->lock); + return IRQ_RETVAL(handled); } /* This routine is logically part of the interrupt handler, but separated diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c index c9e486c3d7d7..a2f8d53a494f 100644 --- a/drivers/net/hp100.c +++ b/drivers/net/hp100.c @@ -320,7 +320,7 @@ static void hp100_misc_interrupt(struct net_device *dev); static void hp100_update_stats(struct net_device *dev); static void hp100_clear_stats(struct hp100_private *lp, int ioaddr); static void hp100_set_multicast_list(struct net_device *dev); -static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void hp100_start_interface(struct net_device *dev); static void hp100_stop_interface(struct net_device *dev); static void hp100_load_eeprom(struct net_device *dev, u_short ioaddr); @@ -2271,7 +2271,7 @@ static void hp100_set_multicast_list(struct net_device *dev) * hardware interrupt handling */ -static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_id; struct hp100_private *lp = (struct hp100_private *) dev->priv; @@ -2280,7 +2280,7 @@ static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) u_int val; if (dev == NULL) - return; + return IRQ_NONE; ioaddr = dev->base_addr; spin_lock(&lp->lock); @@ -2302,7 +2302,7 @@ static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (val == 0) { /* might be a shared interrupt */ spin_unlock(&lp->lock); hp100_ints_on(); - return; + return IRQ_NONE; } /* We're only interested in those interrupts we really enabled. */ /* val &= hp100_inw( IRQ_MASK ); */ @@ -2394,6 +2394,7 @@ static void hp100_interrupt(int irq, void *dev_id, struct pt_regs *regs) spin_unlock(&lp->lock); hp100_ints_on(); + return IRQ_HANDLED; } /* diff --git a/drivers/net/lance.c b/drivers/net/lance.c index bdb1041cbd71..56cc884228a8 100644 --- a/drivers/net/lance.c +++ b/drivers/net/lance.c @@ -278,7 +278,7 @@ static int lance_open_fail(struct net_device *dev); static void lance_init_ring(struct net_device *dev, int mode); static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev); static int lance_rx(struct net_device *dev); -static void lance_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int lance_close(struct net_device *dev); static struct net_device_stats *lance_get_stats(struct net_device *dev); static void set_multicast_list(struct net_device *dev); @@ -945,7 +945,7 @@ out: } /* The LANCE interrupt handler. */ -static void +static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; @@ -955,7 +955,7 @@ lance_interrupt(int irq, void *dev_id, struct pt_regs * regs) if (dev == NULL) { printk ("lance_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; @@ -1066,6 +1066,7 @@ lance_interrupt(int irq, void *dev_id, struct pt_regs * regs) inw(dev->base_addr + LANCE_DATA)); spin_unlock (&lp->devlock); + return IRQ_HANDLED; } static int diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index 52be81396ded..72a2ee6ab655 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c @@ -377,7 +377,7 @@ static char init_setup[14] = { static int i596_open(struct net_device *dev); static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void i596_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs); 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); @@ -1160,7 +1160,7 @@ i596_handle_CU_completion(struct net_device *dev, spin_unlock_irqrestore(&lp->cmd_lock, flags); } -static void +static irqreturn_t i596_interrupt (int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_instance; struct i596_private *lp; @@ -1229,7 +1229,7 @@ i596_interrupt (int irq, void *dev_instance, struct pt_regs *regs) { CA(); out: - return; + return IRQ_HANDLED; } static int i596_close(struct net_device *dev) { diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index 7435e4081d49..df5ff08ac3b9 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c @@ -696,7 +696,7 @@ static void free_ring(struct net_device *dev); static void reinit_ring(struct net_device *dev); static void init_registers(struct net_device *dev); static int start_tx(struct sk_buff *skb, struct net_device *dev); -static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); static void netdev_error(struct net_device *dev, int intr_status); static void netdev_rx(struct net_device *dev); static void netdev_tx_done(struct net_device *dev); @@ -1680,15 +1680,16 @@ static void netdev_tx_done(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = dev_instance; struct netdev_private *np = dev->priv; long ioaddr = dev->base_addr; int boguscnt = max_interrupt_work; + unsigned int handled = 0; if (np->hands_off) - return; + return IRQ_NONE; do { /* Reading automatically acknowledges all int sources. */ u32 intr_status = readl(ioaddr + IntrStatus); @@ -1701,6 +1702,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (intr_status == 0) break; + handled = 1; if (intr_status & (IntrRxDone | IntrRxIntr | RxStatusFIFOOver | @@ -1731,6 +1733,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (netif_msg_intr(np)) printk(KERN_DEBUG "%s: exiting interrupt.\n", dev->name); + + return IRQ_RETVAL(handled); } /* This routine is logically part of the interrupt handler, but separated diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 1941d1bec6f7..06e88ea07243 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c @@ -104,7 +104,7 @@ extern int ni5010_probe(struct net_device *dev); static int ni5010_probe1(struct net_device *dev, int ioaddr); static int ni5010_open(struct net_device *dev); static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev); -static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void ni5010_rx(struct net_device *dev); static void ni5010_timeout(struct net_device *dev); static int ni5010_close(struct net_device *dev); @@ -451,7 +451,7 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev) * The typical workload of the driver: * Handle the network interface interrupts. */ -static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct ni5010_local *lp; @@ -479,7 +479,7 @@ static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (!xmit_was_error) reset_receiver(dev); - return; + return IRQ_HANDLED; } diff --git a/drivers/net/ni52.c b/drivers/net/ni52.c index 0b16f0b64d8d..67f857fc37ae 100644 --- a/drivers/net/ni52.c +++ b/drivers/net/ni52.c @@ -193,7 +193,7 @@ sizeof(nop_cmd) = 8; #define NI52_ADDR2 0x01 static int ni52_probe1(struct net_device *dev,int ioaddr); -static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr); +static irqreturn_t ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr); static int ni52_open(struct net_device *dev); static int ni52_close(struct net_device *dev); static int ni52_send_packet(struct sk_buff *,struct net_device *); @@ -821,7 +821,7 @@ static void *alloc_rfa(struct net_device *dev,void *ptr) * Interrupt Handler ... */ -static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr) +static irqreturn_t ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr) { struct net_device *dev = dev_id; unsigned short stat; @@ -830,7 +830,7 @@ static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr) if (!dev) { printk ("ni5210-interrupt: irq %d for unknown device.\n",irq); - return; + return IRQ_NONE; } p = (struct priv *) dev->priv; @@ -889,6 +889,7 @@ static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr) if(debuglevel > 1) printk("i"); + return IRQ_HANDLED; } /******************************************************* diff --git a/drivers/net/ni65.c b/drivers/net/ni65.c index 6b3b9e2fe802..d19f909c1d86 100644 --- a/drivers/net/ni65.c +++ b/drivers/net/ni65.c @@ -248,7 +248,7 @@ struct priv }; static int ni65_probe1(struct net_device *dev,int); -static void ni65_interrupt(int irq, void * dev_id, struct pt_regs *regs); +static irqreturn_t ni65_interrupt(int irq, void * dev_id, struct pt_regs *regs); static void ni65_recv_intr(struct net_device *dev,int); static void ni65_xmit_intr(struct net_device *dev,int); static int ni65_open(struct net_device *dev); @@ -307,7 +307,6 @@ static int ni65_open(struct net_device *dev) if(ni65_lance_reinit(dev)) { netif_start_queue(dev); - MOD_INC_USE_COUNT; return 0; } else @@ -341,7 +340,6 @@ static int ni65_close(struct net_device *dev) } #endif free_irq(dev->irq,dev); - MOD_DEC_USE_COUNT; return 0; } @@ -512,7 +510,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr) } dev->base_addr = ioaddr; - + SET_MODULE_OWNER(dev); dev->open = ni65_open; dev->stop = ni65_close; dev->hard_start_xmit = ni65_send_packet; @@ -839,7 +837,7 @@ static int ni65_lance_reinit(struct net_device *dev) /* * interrupt handler */ -static void ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs) +static irqreturn_t ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs) { int csr0 = 0; struct net_device *dev = dev_id; @@ -940,7 +938,7 @@ static void ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs) else writedatareg(CSR0_INEA); - return; + return IRQ_HANDLED; } /* diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c index 41b5600955d5..47f1fc9791a4 100644 --- a/drivers/net/ns83820.c +++ b/drivers/net/ns83820.c @@ -549,7 +549,7 @@ static inline int ns83820_add_rx_skb(struct ns83820 *dev, struct sk_buff *skb) static inline int rx_refill(struct ns83820 *dev, int gfp) { unsigned i; - long flags = 0; + unsigned long flags = 0; if (unlikely(nr_rx_empty(dev) <= 2)) return 0; @@ -763,7 +763,7 @@ static int ns83820_setup_rx(struct ns83820 *dev) static void ns83820_cleanup_rx(struct ns83820 *dev) { unsigned i; - long flags; + unsigned long flags; dprintk("ns83820_cleanup_rx(%p)\n", dev); @@ -820,7 +820,7 @@ static void rx_irq(struct ns83820 *dev) struct rx_info *info = &dev->rx_info; unsigned next_rx; u32 cmdsts, *desc; - long flags; + unsigned long flags; int nr = 0; dprintk("rx_irq(%p)\n", dev); @@ -1234,7 +1234,7 @@ static void ns83820_mib_isr(struct ns83820 *dev) } static void ns83820_do_isr(struct ns83820 *dev, u32 isr); -static void ns83820_irq(int foo, void *data, struct pt_regs *regs) +static irqreturn_t ns83820_irq(int foo, void *data, struct pt_regs *regs) { struct ns83820 *dev = data; u32 isr; @@ -1245,6 +1245,7 @@ static void ns83820_irq(int foo, void *data, struct pt_regs *regs) isr = readl(dev->base + ISR); dprintk("irq: %08x\n", isr); ns83820_do_isr(dev, isr); + return IRQ_HANDLED; } static void ns83820_do_isr(struct ns83820 *dev, u32 isr) @@ -1396,7 +1397,7 @@ static void ns83820_tx_timeout(struct net_device *_dev) { struct ns83820 *dev = (struct ns83820 *)_dev; u32 tx_done_idx, *desc; - long flags; + unsigned long flags; local_irq_save(flags); diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index d0e3da99b8fd..83c53ae05658 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -249,6 +249,7 @@ static dev_link_t *tc589_attach(void) link->conf.Present = PRESENT_OPTION; /* The EL3-specific entries in the device structure. */ + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &el3_start_xmit; dev->set_config = &el3_config; dev->get_stats = &el3_get_stats; @@ -740,7 +741,6 @@ static int el3_open(struct net_device *dev) return -ENODEV; link->open++; - MOD_INC_USE_COUNT; netif_start_queue(dev); tc589_reset(dev); @@ -1148,8 +1148,6 @@ static int el3_close(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 36d9b30b2bd2..aa9f4f0febbf 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -98,7 +98,7 @@ static int axnet_event(event_t event, int priority, static int axnet_open(struct net_device *dev); static int axnet_close(struct net_device *dev); static int axnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); -static void ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs); static void ei_watchdog(u_long arg); static void axnet_reset_8390(struct net_device *dev); @@ -122,7 +122,7 @@ static int axdev_init(struct net_device *dev); static void AX88190_init(struct net_device *dev, int startp); static int ax_open(struct net_device *dev); static int ax_close(struct net_device *dev); -static void ax_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t ax_interrupt(int irq, void *dev_id, struct pt_regs *regs); /*====================================================================*/ @@ -687,7 +687,6 @@ static int axnet_open(struct net_device *dev) return -ENODEV; link->open++; - MOD_INC_USE_COUNT; request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); @@ -719,8 +718,6 @@ static int axnet_close(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } /* axnet_close */ @@ -757,11 +754,11 @@ static void axnet_reset_8390(struct net_device *dev) /*====================================================================*/ -static void ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t ei_irq_wrapper(int irq, void *dev_id, struct pt_regs *regs) { axnet_dev_t *info = dev_id; info->stale = 0; - ax_interrupt(irq, dev_id, regs); + return ax_interrupt(irq, dev_id, regs); } static void ei_watchdog(u_long arg) @@ -1345,17 +1342,18 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev) * needed. */ -static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static irqreturn_t ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; long e8390_base; int interrupts, nr_serviced = 0, i; struct ei_device *ei_local; - + int handled = 0; + if (dev == NULL) { printk ("net_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } e8390_base = dev->base_addr; @@ -1378,7 +1376,7 @@ static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) inb_p(e8390_base + EN0_IMR)); #endif spin_unlock(&ei_local->page_lock); - return; + return IRQ_NONE; } if (ei_debug > 3) @@ -1399,6 +1397,8 @@ static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) interrupts = 0; break; } + handled = 1; + /* AX88190 bug fix. */ outb_p(interrupts, e8390_base + EN0_ISR); for (i = 0; i < 10; i++) { @@ -1430,6 +1430,7 @@ static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) if (interrupts && ei_debug) { + handled = 1; if (nr_serviced >= MAX_SERVICE) { /* 0xFF is valid for a card removal */ @@ -1448,7 +1449,7 @@ static void ax_interrupt(int irq, void *dev_id, struct pt_regs * regs) outb_p(ENISR_ALL, e8390_base + EN0_IMR); spin_unlock(&ei_local->page_lock); - return; + return IRQ_RETVAL(handled); } /** @@ -1842,6 +1843,8 @@ static int axdev_init(struct net_device *dev) if (ei_debug > 1) printk(version_8390); + SET_MODULE_OWNER(dev); + if (dev->priv == NULL) { struct ei_device *ei_local; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index a43a36636dbd..dc6557201ab9 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -314,6 +314,7 @@ static dev_link_t *fmvj18x_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* The FMVJ18x specific entries in the device structure. */ + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &fjn_start_xmit; dev->set_config = &fjn_config; dev->get_stats = &fjn_get_stats; @@ -1287,8 +1288,6 @@ static int fjn_open(struct net_device *dev) lp->open_time = jiffies; netif_start_queue(dev); - MOD_INC_USE_COUNT; - return 0; } /* fjn_open */ @@ -1323,7 +1322,6 @@ static int fjn_close(struct net_device *dev) link->open--; if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; return 0; } /* fjn_close */ @@ -1369,9 +1367,11 @@ static void set_rx_mode(struct net_device *dev) memset(mc_filter, 0, sizeof(mc_filter)); for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; - i++, mclist = mclist->next) - set_bit(ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f, - mc_filter); + i++, mclist = mclist->next) { + unsigned int bit = + ether_crc_le(ETH_ALEN, mclist->dmi_addr) & 0x3f; + mc_filter[bit >> 3] |= (1 << bit); + } } save_flags(flags); diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index c4c199585ad8..84b58d18166e 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -515,6 +515,7 @@ static dev_link_t *nmclan_attach(void) lp->tx_free_frames=AM2150_MAX_TX_FRAMES; + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &mace_start_xmit; dev->set_config = &mace_config; dev->get_stats = &mace_get_stats; @@ -974,7 +975,6 @@ static int mace_open(struct net_device *dev) return -ENODEV; link->open++; - MOD_INC_USE_COUNT; MACEBANK(0); @@ -1004,8 +1004,6 @@ static int mace_close(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } /* mace_close */ diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 81210905c2f6..543dacff82b3 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -315,6 +315,7 @@ static dev_link_t *pcnet_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; ethdev_init(dev); + SET_MODULE_OWNER(dev); dev->init = &pcnet_init; dev->open = &pcnet_open; dev->stop = &pcnet_close; @@ -1030,7 +1031,6 @@ static int pcnet_open(struct net_device *dev) return -ENODEV; link->open++; - MOD_INC_USE_COUNT; set_misc_reg(dev); request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev); @@ -1064,8 +1064,6 @@ static int pcnet_close(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } /* pcnet_close */ diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index d1c41d0b5bcd..1c198e0ae70a 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -376,6 +376,7 @@ static dev_link_t *smc91c92_attach(void) link->conf.IntType = INT_MEMORY_AND_IO; /* The SMC91c92-specific entries in the device structure. */ + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &smc_start_xmit; dev->get_stats = &smc_get_stats; dev->set_config = &s9k_config; @@ -1301,7 +1302,6 @@ static int smc_open(struct net_device *dev) return -ENODEV; } link->open++; - MOD_INC_USE_COUNT; netif_start_queue(dev); smc->saved_skb = 0; @@ -1347,8 +1347,6 @@ static int smc_close(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } /* smc_close */ diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index ab17d29e01a5..0339b7cdce30 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -646,6 +646,7 @@ xirc2ps_attach(void) link->irq.Instance = dev; /* Fill in card specific entries */ + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &do_start_xmit; dev->set_config = &do_config; dev->get_stats = &do_get_stats; @@ -1714,7 +1715,6 @@ do_open(struct net_device *dev) /* okay */ link->open++; - MOD_INC_USE_COUNT; netif_start_queue(dev); do_reset(dev,1); @@ -2066,8 +2066,6 @@ do_stop(struct net_device *dev) if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; - return 0; } diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 80350247b223..30f741193b5b 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c @@ -331,7 +331,7 @@ static int pcnet32_init_ring(struct net_device *); static int pcnet32_start_xmit(struct sk_buff *, struct net_device *); static int pcnet32_rx(struct net_device *); static void pcnet32_tx_timeout (struct net_device *dev); -static void pcnet32_interrupt(int, void *, struct pt_regs *); +static irqreturn_t pcnet32_interrupt(int, void *, struct pt_regs *); static int pcnet32_close(struct net_device *); static struct net_device_stats *pcnet32_get_stats(struct net_device *); static void pcnet32_set_multicast_list(struct net_device *); @@ -717,6 +717,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared, spin_lock_init(&lp->lock); + SET_MODULE_OWNER(dev); dev->priv = lp; lp->name = chipname; lp->shared_irq = shared; @@ -945,8 +946,6 @@ pcnet32_open(struct net_device *dev) lp->a.read_csr(ioaddr, 0)); - MOD_INC_USE_COUNT; - return 0; /* Always succeed */ } @@ -1148,7 +1147,7 @@ pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev) } /* The PCNET32 interrupt handler. */ -static void +static irqreturn_t pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; @@ -1161,7 +1160,7 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs) if (!dev) { printk (KERN_DEBUG "%s(): irq %d for unknown device\n", __FUNCTION__, irq); - return; + return IRQ_NONE; } ioaddr = dev->base_addr; @@ -1293,6 +1292,8 @@ pcnet32_interrupt(int irq, void *dev_id, struct pt_regs * regs) dev->name, lp->a.read_csr (ioaddr, 0)); spin_unlock(&lp->lock); + + return IRQ_HANDLED; } static int @@ -1440,8 +1441,6 @@ pcnet32_close(struct net_device *dev) lp->tx_dma_addr[i] = 0; } - MOD_DEC_USE_COUNT; - return 0; } diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index a184b80b935c..4c7dd2ee759b 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -295,7 +295,7 @@ MODULE_PARM(media, "1-" __MODULE_STRING(MAX_UNITS) "i"); static int rtl8169_open(struct net_device *dev); static int rtl8169_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void rtl8169_interrupt(int irq, void *dev_instance, +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static void rtl8169_init_ring(struct net_device *dev); static void rtl8169_hw_start(struct net_device *dev); @@ -958,7 +958,7 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp, } /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void +static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_instance; @@ -966,6 +966,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) int boguscnt = max_interrupt_work; void *ioaddr = tp->mmio_addr; int status = 0; + int handled = 0; do { status = RTL_R16(IntrStatus); @@ -974,6 +975,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if (status == 0xFFFF) break; + handled = 1; /* if (status & RxUnderrun) link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit; @@ -1006,6 +1008,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) /* Clear all interrupt sources. */ RTL_W16(IntrStatus, 0xffff); } + return IRQ_RETVAL(handled); } static int diff --git a/drivers/net/rclanmtl.c b/drivers/net/rclanmtl.c index 834d670df2c0..14bd88ab271b 100644 --- a/drivers/net/rclanmtl.c +++ b/drivers/net/rclanmtl.c @@ -301,13 +301,13 @@ RCInitI2OMsgLayer (struct net_device *dev, PPAB pPab; U32 pciBaseAddr = dev->base_addr; PDPA pDpa = dev->priv; - PU8 p_msgbuf = pDpa->PLanApiPA; - PU8 p_phymsgbuf = (PU8) virt_to_bus ((void *) p_msgbuf); + PU8 p_msgbuf = pDpa->msgbuf; + PU8 p_phymsgbuf = (PU8) pDpa->msgbuf_dma; dprintk - ("InitI2O: Adapter:0x%04ux ATU:0x%08ulx msgbuf:0x%08ulx phymsgbuf:0x%08ulx\n" + ("InitI2O: Adapter:0x%04ux ATU:0x%08ulx msgbuf:%p phymsgbuf:0x%08ulx\n" "TransmitCallbackFunction:0x%08ulx ReceiveCallbackFunction:0x%08ulx\n", - pDpa->id, pciBaseAddr, (u32) p_msgbuf, (u32) p_phymsgbuf, + pDpa->id, pciBaseAddr, p_msgbuf, (u32) p_phymsgbuf, (u32) TransmitCallbackFunction, (u32) ReceiveCallbackFunction); /* Check if this interface already initialized - if so, shut it down */ @@ -445,7 +445,7 @@ RCI2OSendPacket (struct net_device * dev, U32 InitiatorContext, return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); size = FillI2OMsgSGLFromTCB (pMsg + 4, pTransCtrlBlock); @@ -502,7 +502,7 @@ RCPostRecvBuffers (struct net_device * dev, PRCTCB pTransCtrlBlock) dprintk ("RCPostRecvBuffers(): Inbound Free Q empty!\n"); return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); size = FillI2OMsgSGLFromTCB (pMsg + 4, pTransCtrlBlock); @@ -538,7 +538,7 @@ RCPostRecvBuffers (struct net_device * dev, PRCTCB pTransCtrlBlock) ** Process I2O outbound message queue until empty. ** ========================================================================= */ -void +irqreturn_t RCProcI2OMsgQ (struct net_device *dev) { U32 phyAddrMsg; @@ -549,7 +549,7 @@ RCProcI2OMsgQ (struct net_device *dev) unsigned char debug_msg[20]; if (pPab == NULL) - return; + return IRQ_NONE; phyAddrMsg = pPab->p_atu->OutQueue; @@ -642,6 +642,8 @@ RCProcI2OMsgQ (struct net_device *dev) /* any more msgs? */ phyAddrMsg = pPab->p_atu->OutQueue; } + + return IRQ_HANDLED; } /* @@ -677,7 +679,7 @@ RCGetLinkStatistics (struct net_device *dev, return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /*dprintk("Get82558Stats - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n", pMsg, msgOffset);*/ @@ -751,7 +753,7 @@ RCGetLinkStatus (struct net_device * dev, PU32 ReturnAddr, return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /*dprintk("Get82558LinkStatus - pMsg = 0x%08ulx, InQ msgOffset = 0x%08ulx\n", pMsg, msgOffset);*/ /*dprintk("Get82558LinkStatus - pMsg = 0x%08X, InQ msgOffset = 0x%08X\n", pMsg, msgOffset);*/ @@ -1452,7 +1454,7 @@ RCResetIOP (struct net_device * dev) pMsg[7] = 0; pMsg[8] = 1; /* return 1 byte */ - /* virual pointer to return buffer - clear first two dwords */ + /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0; p32[1] = 0; @@ -1693,7 +1695,7 @@ SendI2OOutboundQInitMsg (PPAB pPab) return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); dprintk @@ -1711,7 +1713,7 @@ SendI2OOutboundQInitMsg (PPAB pPab) /* phys address to return status - area right after PAB */ pMsg[7] = pPab->outMsgBlockPhyAddr; - /* virual pointer to return buffer - clear first two dwords */ + /* virtual pointer to return buffer - clear first two dwords */ p32 = (PU32) pPab->pLinOutMsgBlock; p32[0] = 0; @@ -1779,7 +1781,7 @@ GetI2OStatus (PPAB pPab) return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); pMsg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_0; @@ -1793,7 +1795,7 @@ GetI2OStatus (PPAB pPab) pMsg[7] = 0; pMsg[8] = 88; /* return 88 bytes */ - /* virual pointer to return buffer - clear first two dwords */ + /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0; p32[1] = 0; @@ -1862,7 +1864,7 @@ SendEnableSysMsg (PPAB pPab) return RC_RTN_FREE_Q_EMPTY; } - /* calc virual address of msg - virual already mapped to physical */ + /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); dprintk @@ -1885,7 +1887,7 @@ SendEnableSysMsg (PPAB pPab) ** ========================================================================= ** FillI2OMsgFromTCB() ** -** inputs pMsgU32 - virual pointer (mapped to physical) of message frame +** inputs pMsgU32 - virtual pointer (mapped to physical) of message frame ** pXmitCntrlBlock - pointer to caller buffer control block. ** ** fills in LAN SGL after Transaction Control Word or Bucket Count. diff --git a/drivers/net/rclanmtl.h b/drivers/net/rclanmtl.h index a65c1d94a83b..5be9278684d3 100644 --- a/drivers/net/rclanmtl.h +++ b/drivers/net/rclanmtl.h @@ -182,6 +182,7 @@ typedef struct { U32 pci_addr; /* the pci address of the adapter */ U32 pci_addr_len; + struct pci_dev *pci_dev; struct timer_list timer; /* timer */ struct net_device_stats stats; /* the statistics structure */ unsigned long numOutRcvBuffers; /* number of outstanding receive buffers */ @@ -189,7 +190,7 @@ typedef struct { unsigned char reboot; unsigned char nexus; PU8 msgbuf; /* Pointer to Lan Api Private Area */ - PU8 PLanApiPA; /* Pointer to Lan Api Private Area (aligned) */ + dma_addr_t msgbuf_dma; PPAB pPab; /* Pointer to the PCI Adapter Block */ } *PDPA; @@ -421,7 +422,7 @@ RCGetRavlinIPandMask (struct net_device *dev, PU32 pIpAddr, PU32 pNetMask, ** callback functions, TransmitCallbackFunction or ReceiveCallbackFunction, ** if a TX or RX transaction has completed. */ -void RCProcI2OMsgQ (struct net_device *dev); +irqreturn_t RCProcI2OMsgQ (struct net_device *dev); /* ** Disable and Enable I2O interrupts. I2O interrupts are enabled at Init time diff --git a/drivers/net/rcpci45.c b/drivers/net/rcpci45.c index a79d44acb804..78ff9d5bfb4f 100644 --- a/drivers/net/rcpci45.c +++ b/drivers/net/rcpci45.c @@ -29,6 +29,8 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** +** Francois Romieu, Apr 2003: Converted to pci DMA mapping API. +** ** Pete Popov, Oct 2001: Fixed a few bugs to make the driver functional ** again. Note that this card is not supported or manufactured by ** RedCreek anymore. @@ -47,8 +49,6 @@ ** ***************************************************************************/ -#error Please convert me to Documentation/DMA-mapping.txt - #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> @@ -66,7 +66,7 @@ #include <asm/uaccess.h> static char version[] __initdata = - "RedCreek Communications PCI linux driver version 2.20\n"; + "RedCreek Communications PCI linux driver version 2.21\n"; #define RC_LINUX_MODULE #include "rclanmtl.h" @@ -95,13 +95,19 @@ static char version[] __initdata = */ #define MSG_BUF_SIZE 16384 +/* 2003/04/20: I don't know about the hardware ability but the driver won't + * play safe with 64 bit addressing and DAC without NETIF_F_HIGHDMA doesn't + * really make sense anyway. Let's play safe - romieu. + */ +#define RCPCI45_DMA_MASK ((u64) 0xffffffff) + static U32 DriverControlWord; static void rc_timer (unsigned long); static int RCopen (struct net_device *); static int RC_xmit_packet (struct sk_buff *, struct net_device *); -static void RCinterrupt (int, void *, struct pt_regs *); +static irqreturn_t RCinterrupt (int, void *, struct pt_regs *); static int RCclose (struct net_device *dev); static struct net_device_stats *RCget_stats (struct net_device *); static int RCioctl (struct net_device *, struct ifreq *, int); @@ -136,8 +142,8 @@ rcpci45_remove_one (struct pci_dev *pdev) free_irq (dev->irq, dev); iounmap ((void *) dev->base_addr); pci_release_regions (pdev); - if (pDpa->msgbuf) - kfree (pDpa->msgbuf); + pci_free_consistent (pdev, MSG_BUF_SIZE, pDpa->msgbuf, + pDpa->msgbuf_dma); if (pDpa->pPab) kfree (pDpa->pPab); kfree (dev); @@ -172,6 +178,7 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) error = -ENOMEM; goto err_out; } + SET_MODULE_OWNER(dev); error = pci_enable_device (pdev); if (error) { @@ -180,7 +187,6 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) card_idx); goto err_out; } - error = -ENOMEM; pci_start = pci_resource_start (pdev, 0); pci_len = pci_resource_len (pdev, 0); printk("pci_start %lx pci_len %lx\n", pci_start, pci_len); @@ -189,6 +195,7 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) pDpa = dev->priv; pDpa->id = card_idx; + pDpa->pci_dev = pdev; pDpa->pci_addr = pci_start; if (!pci_start || !(pci_resource_flags (pdev, 0) & IORESOURCE_MEM)) { @@ -200,24 +207,21 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) /* * pDpa->msgbuf is where the card will dma the I2O - * messages. Thus, we need contiguous physical pages of - * memory. - */ - pDpa->msgbuf = kmalloc (MSG_BUF_SIZE, GFP_DMA | GFP_KERNEL); + * messages. Thus, we need contiguous physical pages of memory. + * 2003/04/20: pci_alloc_consistent() provides well over the needed + * alignment on a 256 bytes boundary for the LAN API private area. + * Thus it isn't needed anymore to align it by hand. + */ + pDpa->msgbuf = pci_alloc_consistent (pdev, MSG_BUF_SIZE, + &pDpa->msgbuf_dma); if (!pDpa->msgbuf) { printk (KERN_ERR "(rcpci45 driver:) \ Could not allocate %d byte memory for the \ private msgbuf!\n", MSG_BUF_SIZE); + error = -ENOMEM; goto err_out_free_dev; } - /* - * Save the starting address of the LAN API private area. We'll - * pass that to RCInitI2OMsgLayer(). - * - */ - pDpa->PLanApiPA = (void *) (((long) pDpa->msgbuf + 0xff) & ~0xff); - /* The adapter is accessible through memory-access read/write, not * I/O read/write. Thus, we need to map it to some virtual address * area in order to access the registers as normal memory. @@ -226,12 +230,20 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) if (error) goto err_out_free_msgbuf; + error = pci_set_dma_mask (pdev, RCPCI45_DMA_MASK); + if (error) { + printk (KERN_ERR + "(rcpci45 driver:) pci_set_dma_mask failed!\n"); + goto err_out_free_region; + } + vaddr = (ulong *) ioremap (pci_start, pci_len); if (!vaddr) { printk (KERN_ERR "(rcpci45 driver:) \ Unable to remap address range from %lu to %lu\n", pci_start, pci_start + pci_len); + error = -EIO; goto err_out_free_region; } @@ -249,13 +261,14 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) err_out_free_region: pci_release_regions (pdev); err_out_free_msgbuf: - kfree (pDpa->msgbuf); + pci_free_consistent (pdev, MSG_BUF_SIZE, pDpa->msgbuf, + pDpa->msgbuf_dma); err_out_free_dev: unregister_netdev (dev); kfree (dev); err_out: card_idx--; - return -ENODEV; + return error; } static struct pci_driver rcpci45_driver = { @@ -283,7 +296,6 @@ RCopen (struct net_device *dev) int requested = 0; int error; - MOD_INC_USE_COUNT; if (pDpa->nexus) { /* This is not the first time RCopen is called. Thus, * the interface was previously opened and later closed @@ -365,7 +377,6 @@ RCopen (struct net_device *dev) err_out_free_irq: free_irq (dev->irq, dev); err_out: - MOD_DEC_USE_COUNT; return error; } @@ -402,7 +413,8 @@ RC_xmit_packet (struct sk_buff *skb, struct net_device *dev) ptcb->b.context = (U32) skb; ptcb->b.scount = 1; ptcb->b.size = skb->len; - ptcb->b.addr = virt_to_bus ((void *) skb->data); + ptcb->b.addr = pci_map_single(pDpa->pci_dev, skb->data, skb->len, + PCI_DMA_TODEVICE); if ((status = RCI2OSendPacket (dev, (U32) NULL, (PRCTCB) ptcb)) != RC_RTN_NO_ERROR) { @@ -451,6 +463,8 @@ RCxmit_callback (U32 Status, while (PcktCount--) { skb = (struct sk_buff *) (BufferContext[0]); BufferContext++; + pci_unmap_single(pDpa->pci_dev, BufferContext[1], skb->len, + PCI_DMA_TODEVICE); dev_kfree_skb_irq (skb); } netif_wake_queue (dev); @@ -621,7 +635,7 @@ RCrecv_callback (U32 Status, * RCProcI2OMsgQ(), which in turn process the message and * calls one of our callback functions. */ -static void +static irqreturn_t RCinterrupt (int irq, void *dev_id, struct pt_regs *regs) { @@ -634,7 +648,7 @@ RCinterrupt (int irq, void *dev_id, struct pt_regs *regs) printk (KERN_DEBUG "%s: shutdown, service irq\n", dev->name); - RCProcI2OMsgQ (dev); + return RCProcI2OMsgQ (dev); } #define REBOOT_REINIT_RETRY_LIMIT 4 @@ -706,6 +720,7 @@ rc_timer (unsigned long data) RCDisableI2OInterrupts (dev); dev->flags &= ~IFF_UP; MOD_DEC_USE_COUNT; + /* FIXME: kill MOD_DEC_USE_COUNT, use dev_put */ } else { printk (KERN_INFO "%s: rescheduling timer...\n", dev->name); @@ -731,7 +746,6 @@ RCclose (struct net_device *dev) printk (KERN_INFO "%s skipping reset -- adapter already in reboot mode\n", dev->name); dev->flags &= ~IFF_UP; pDpa->shutdown = 1; - MOD_DEC_USE_COUNT; return 0; } @@ -749,7 +763,6 @@ RCclose (struct net_device *dev) (PFNCALLBACK) RCreset_callback); dev->flags &= ~IFF_UP; - MOD_DEC_USE_COUNT; return 0; } @@ -984,8 +997,9 @@ RC_allocate_and_post_buffers (struct net_device *dev, int numBuffers) PU32 p; psingleB pB; struct sk_buff *skb; + PDPA pDpa = dev->priv; RC_RETURN status; - U32 res; + U32 res = 0; if (!numBuffers) return 0; @@ -1001,7 +1015,7 @@ RC_allocate_and_post_buffers (struct net_device *dev, int numBuffers) if (!p) { printk (KERN_WARNING "%s unable to allocate TCB\n", dev->name); - return 0; + goto out; } p[0] = 0; /* Buffer Count */ @@ -1013,18 +1027,14 @@ RC_allocate_and_post_buffers (struct net_device *dev, int numBuffers) printk (KERN_WARNING "%s: unable to allocate enough skbs!\n", dev->name); - if (*p != 0) { /* did we allocate any buffers */ - break; - } else { - kfree (p); /* Free the TCB */ - return 0; - } + goto err_out_unmap; } skb_reserve (skb, 2); /* Align IP on 16 byte boundaries */ pB->context = (U32) skb; pB->scount = 1; /* segment count */ pB->size = MAX_ETHER_SIZE; - pB->addr = virt_to_bus ((void *) skb->data); + pB->addr = pci_map_single(pDpa->pci_dev, skb->data, + MAX_ETHER_SIZE, PCI_DMA_FROMDEVICE); p[0]++; pB++; } @@ -1032,16 +1042,21 @@ RC_allocate_and_post_buffers (struct net_device *dev, int numBuffers) if ((status = RCPostRecvBuffers (dev, (PRCTCB) p)) != RC_RTN_NO_ERROR) { printk (KERN_WARNING "%s: Post buffer failed, error 0x%x\n", dev->name, status); - /* point to the first buffer */ - pB = (psingleB) ((U32) p + sizeof (U32)); - while (p[0]) { - skb = (struct sk_buff *) pB->context; - dev_kfree_skb (skb); - p[0]--; - pB++; - } + goto err_out_unmap; } +out_free: res = p[0]; kfree (p); +out: return (res); /* return the number of posted buffers */ + +err_out_unmap: + for (; p[0] > 0; p[0]--) { + --pB; + skb = (struct sk_buff *) pB->context; + pci_unmap_single(pDpa->pci_dev, pB->addr, MAX_ETHER_SIZE, + PCI_DMA_FROMDEVICE); + dev_kfree_skb (skb); + } + goto out_free; } diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index 3d0821d1a420..34c6792e6116 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c @@ -195,11 +195,11 @@ static void sis900_init_rx_ring(struct net_device *net_dev); static int sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev); static int sis900_rx(struct net_device *net_dev); static void sis900_finish_xmit (struct net_device *net_dev); -static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int sis900_close(struct net_device *net_dev); static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd); static struct net_device_stats *sis900_get_stats(struct net_device *net_dev); -static u16 sis900_compute_hashtable_index(u8 *addr, u8 revision); +static u16 sis900_mcast_bitnr(u8 *addr, u8 revision); static void set_rx_mode(struct net_device *net_dev); static void sis900_reset(struct net_device *net_dev); static void sis630_set_eq(struct net_device *net_dev, u8 revision); @@ -1534,13 +1534,14 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) * and cleans up after the Tx thread */ -static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *net_dev = dev_instance; struct sis900_private *sis_priv = net_dev->priv; int boguscnt = max_interrupt_work; long ioaddr = net_dev->base_addr; u32 status; + unsigned int handled = 0; spin_lock (&sis_priv->lock); @@ -1550,6 +1551,7 @@ static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if ((status & (HIBERR|TxURN|TxERR|TxIDLE|RxORN|RxERR|RxOK)) == 0) /* nothing intresting happened */ break; + handled = 1; /* why dow't we break after Tx/Rx case ?? keyword: full-duplex */ if (status & (RxORN | RxERR | RxOK)) @@ -1580,7 +1582,7 @@ static void sis900_interrupt(int irq, void *dev_instance, struct pt_regs *regs) net_dev->name, inl(ioaddr + isr)); spin_unlock (&sis_priv->lock); - return; + return IRQ_RETVAL(handled); } /** @@ -2031,7 +2033,7 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map) } /** - * sis900_compute_hashtable_index: - compute hashtable index + * sis900_mcast_bitnr: - compute hashtable index * @addr: multicast address * @revision: revision id of chip * @@ -2041,7 +2043,7 @@ static int sis900_set_config(struct net_device *dev, struct ifmap *map) * multicast hash table. */ -static u16 sis900_compute_hashtable_index(u8 *addr, u8 revision) +static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision) { u32 crc = ether_crc(6, addr); @@ -2095,9 +2097,11 @@ static void set_rx_mode(struct net_device *net_dev) struct dev_mc_list *mclist; rx_mode = RFAAB; for (i = 0, mclist = net_dev->mc_list; mclist && i < net_dev->mc_count; - i++, mclist = mclist->next) - set_bit(sis900_compute_hashtable_index(mclist->dmi_addr, revision), - mc_filter); + i++, mclist = mclist->next) { + unsigned int bit_nr = + sis900_mcast_bitnr(mclist->dmi_addr, revision); + mc_filter[bit_nr >> 4] |= (1 << bit_nr); + } } /* update Multicast Hash Table in Receive Filter */ diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 664ceb907fe9..b0e501181c72 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -322,8 +322,8 @@ static void BoardInitMem(SK_AC *pAC); static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, SK_BOOL); -static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); -static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); +static irqreturn_t SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); +static irqreturn_t SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); static int SkGeOpen(struct net_device *dev); static int SkGeClose(struct net_device *dev); static int SkGeXmit(struct sk_buff *skb, struct net_device *dev); @@ -470,6 +470,7 @@ static int __init skge_probe (void) pNet->Up = 0; dev->irq = pdev->irq; + SET_MODULE_OWNER(dev); dev->open = &SkGeOpen; dev->stop = &SkGeClose; dev->hard_start_xmit = &SkGeXmit; @@ -1236,7 +1237,7 @@ int PortIndex) /* index of the port for which to re-init */ * Returns: N/A * */ -static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs) +static irqreturn_t SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs) { struct net_device *dev = (struct net_device *)dev_id; @@ -1252,7 +1253,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ */ SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc); if (IntSrc == 0) { - return; + return IRQ_NONE; } while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { @@ -1380,7 +1381,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ /* IRQ is processed - Enable IRQs again*/ SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); - return; + return IRQ_HANDLED; } /* SkGeIsr */ @@ -1397,7 +1398,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ * Returns: N/A * */ -static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs) +static irqreturn_t SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs) { struct net_device *dev = (struct net_device *)dev_id; DEV_NET *pNet; @@ -1412,7 +1413,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ */ SK_IN32(pAC->IoBase, B0_SP_ISRC, &IntSrc); if (IntSrc == 0) { - return; + return IRQ_NONE; } while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { @@ -1498,7 +1499,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ /* IRQ is processed - Enable IRQs again*/ SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); - return; + return IRQ_HANDLED; } /* SkGeIsrOnePort */ @@ -1604,8 +1605,6 @@ SK_EVPARA EvPara; /* an event parameter union */ pAC->MaxPorts++; pNet->Up = 1; - MOD_INC_USE_COUNT; - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, ("SkGeOpen suceeded\n")); @@ -1705,7 +1704,6 @@ SK_EVPARA EvPara; pAC->MaxPorts--; pNet->Up = 0; - MOD_DEC_USE_COUNT; return (0); } /* SkGeClose */ diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c index b66915f147eb..7d9d24d5d326 100644 --- a/drivers/net/smc9194.c +++ b/drivers/net/smc9194.c @@ -234,7 +234,7 @@ static void smc_set_multicast_list(struct net_device *dev); /* . Handles the actual interrupt */ -static void smc_interrupt(int irq, void *, struct pt_regs *regs); +static irqreturn_t smc_interrupt(int irq, void *, struct pt_regs *regs); /* . This is a separate procedure to handle the receipt of a packet, to . leave the interrupt code looking slightly cleaner @@ -1133,7 +1133,7 @@ static void smc_timeout(struct net_device *dev) . ---------------------------------------------------------------------*/ -static void smc_interrupt(int irq, void * dev_id, struct pt_regs * regs) +static irqreturn_t smc_interrupt(int irq, void * dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; int ioaddr = dev->base_addr; @@ -1146,7 +1146,7 @@ static void smc_interrupt(int irq, void * dev_id, struct pt_regs * regs) /* state registers */ word saved_bank; word saved_pointer; - + int handled = 0; PRINTK3((CARDNAME": SMC interrupt started \n")); @@ -1171,6 +1171,8 @@ static void smc_interrupt(int irq, void * dev_id, struct pt_regs * regs) if (!status ) break; + handled = 1; + PRINTK3((KERN_WARNING CARDNAME ": Handling interrupt status %x \n", status )); @@ -1242,7 +1244,7 @@ static void smc_interrupt(int irq, void * dev_id, struct pt_regs * regs) SMC_SELECT_BANK( saved_bank ); PRINTK3((CARDNAME ": Interrupt done\n")); - return; + return IRQ_RETVAL(handled); } /*------------------------------------------------------------- diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 80c3d768961f..9aae78c646b3 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c @@ -789,7 +789,7 @@ 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 void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); static void netdev_error(struct net_device *dev, int intr_status); static int __netdev_rx(struct net_device *dev, int *quota); static void refill_rx_ring(struct net_device *dev); @@ -1491,7 +1491,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = dev_instance; struct netdev_private *np; @@ -1499,6 +1499,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) int boguscnt = max_interrupt_work; int consumer; int tx_status; + int handled = 0; ioaddr = dev->base_addr; np = dev->priv; @@ -1513,6 +1514,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (intr_status == 0 || intr_status == (u32) -1) break; + handled = 1; + if (intr_status & (IntrRxDone | IntrRxEmpty)) netdev_rx(dev, ioaddr); @@ -1591,6 +1594,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (debug > 4) printk(KERN_DEBUG "%s: exiting interrupt, status=%#8.8x.\n", dev->name, (int) readl(ioaddr + IntrStatus)); + return IRQ_RETVAL(handled); } diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 07a30493928b..9f626885d29c 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c @@ -495,7 +495,7 @@ 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 int reset_tx (struct net_device *dev); -static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); static void rx_poll(unsigned long data); static void tx_poll(unsigned long data); static void refill_rx (struct net_device *dev); @@ -951,7 +951,7 @@ static void tx_timeout(struct net_device *dev) { struct netdev_private *np = dev->priv; long ioaddr = dev->base_addr; - long flag; + unsigned long flag; netif_stop_queue(dev); tasklet_disable(&np->tx_tasklet); @@ -1152,7 +1152,7 @@ reset_tx (struct net_device *dev) /* The interrupt handler cleans up after the Tx thread, and schedule a Rx thread work */ -static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *)dev_instance; struct netdev_private *np; @@ -1161,6 +1161,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) int hw_frame_id; int tx_cnt; int tx_status; + int handled = 0; ioaddr = dev->base_addr; np = dev->priv; @@ -1176,6 +1177,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (!(intr_status & DEFAULT_INTR)) break; + handled = 1; + if (intr_status & (IntrRxDMADone)) { writew(DEFAULT_INTR & ~(IntrRxDone|IntrRxDMADone), ioaddr + IntrEnable); @@ -1284,7 +1287,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", dev->name, readw(ioaddr + IntrStatus)); writel(5000, ioaddr + DownCounter); - + return IRQ_RETVAL(handled); } static void rx_poll(unsigned long data) diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c index e9282a3075de..5f02c533f8f7 100644 --- a/drivers/net/tlan.c +++ b/drivers/net/tlan.c @@ -288,7 +288,7 @@ static void TLan_Eisa_Cleanup( void ); static int TLan_Init( struct net_device * ); static int TLan_Open( struct net_device *dev ); static int TLan_StartTx( struct sk_buff *, struct net_device *); -static void TLan_HandleInterrupt( int, void *, struct pt_regs *); +static irqreturn_t TLan_HandleInterrupt( int, void *, struct pt_regs *); static int TLan_Close( struct net_device *); static struct net_device_stats *TLan_GetStats( struct net_device *); static void TLan_SetMulticastList( struct net_device *); @@ -1106,7 +1106,7 @@ static int TLan_StartTx( struct sk_buff *skb, struct net_device *dev ) * **************************************************************/ -static void TLan_HandleInterrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t TLan_HandleInterrupt(int irq, void *dev_id, struct pt_regs *regs) { u32 ack; struct net_device *dev; @@ -1134,6 +1134,7 @@ static void TLan_HandleInterrupt(int irq, void *dev_id, struct pt_regs *regs) spin_unlock(&priv->lock); + return IRQ_HANDLED; } /* TLan_HandleInterrupts */ diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index d26294d9f4bf..952d0d374914 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c @@ -492,7 +492,7 @@ rx_next: de->rx_tail = rx_tail; } -static void de_interrupt (int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t de_interrupt (int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = dev_instance; struct de_private *de = dev->priv; @@ -500,7 +500,7 @@ static void de_interrupt (int irq, void *dev_instance, struct pt_regs *regs) status = dr32(MacStatus); if ((!(status & (IntrOK|IntrErr))) || (status == 0xFFFF)) - return; + return IRQ_NONE; if (netif_msg_intr(de)) printk(KERN_DEBUG "%s: intr, status %08x mode %08x desc %u/%u/%u\n", @@ -532,6 +532,8 @@ static void de_interrupt (int irq, void *dev_instance, struct pt_regs *regs) printk(KERN_ERR "%s: PCI bus error, status=%08x, PCI status=%04x\n", dev->name, status, pci_status); } + + return IRQ_HANDLED; } static void de_tx (struct de_private *de) diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c index ea2d4bfe715f..98d78d98c542 100644 --- a/drivers/net/tulip/de4x5.c +++ b/drivers/net/tulip/de4x5.c @@ -909,7 +909,7 @@ static struct { */ static int de4x5_open(struct net_device *dev); static int de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev); -static void de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int de4x5_close(struct net_device *dev); static struct net_device_stats *de4x5_get_stats(struct net_device *dev); static void de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len); @@ -1349,6 +1349,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct pci_dev *pdev) } /* The DE4X5-specific entries in the device structure. */ + SET_MODULE_OWNER(dev); dev->open = &de4x5_open; dev->hard_start_xmit = &de4x5_queue_pkt; dev->stop = &de4x5_close; @@ -1433,8 +1434,6 @@ de4x5_open(struct net_device *dev) printk("\tsigr: 0x%08x\n", inl(DE4X5_SIGR)); } - MOD_INC_USE_COUNT; - return status; } @@ -1617,17 +1616,18 @@ de4x5_queue_pkt(struct sk_buff *skb, struct net_device *dev) ** is high and descriptor status bits cannot be set before the associated ** interrupt is asserted and this routine entered. */ -static void +static irqreturn_t de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; struct de4x5_private *lp; s32 imr, omr, sts, limit; u_long iobase; + unsigned int handled = 0; if (dev == NULL) { printk ("de4x5_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } lp = (struct de4x5_private *)dev->priv; spin_lock(&lp->lock); @@ -1645,6 +1645,7 @@ de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) outl(sts, DE4X5_STS); /* Reset the board interrupts */ if (!(sts & lp->irq_mask)) break;/* All done */ + handled = 1; if (sts & (STS_RI | STS_RU)) /* Rx interrupt (packet[s] arrived) */ de4x5_rx(dev); @@ -1665,7 +1666,7 @@ de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) printk("%s: Fatal bus error occurred, sts=%#8x, device stopped.\n", dev->name, sts); spin_unlock(&lp->lock); - return; + return IRQ_HANDLED; } } @@ -1681,7 +1682,7 @@ de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) ENABLE_IRQs; spin_unlock(&lp->lock); - return; + return IRQ_RETVAL(handled); } static int @@ -1924,8 +1925,6 @@ de4x5_close(struct net_device *dev) de4x5_free_rx_buffs(dev); de4x5_free_tx_buffs(dev); - MOD_DEC_USE_COUNT; - /* Put the adapter to sleep to save power */ yawn(dev, SLEEP); diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index b2d33c9ac274..845dd8cb8902 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c @@ -298,7 +298,7 @@ static struct net_device_stats * dmfe_get_stats(struct DEVICE *); static void dmfe_set_filter_mode(struct DEVICE *); static int dmfe_do_ioctl(struct DEVICE *, struct ifreq *, int); static u16 read_srom_word(long ,int); -static void dmfe_interrupt(int , void *, struct pt_regs *); +static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *); static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long); static void allocate_rx_buffer(struct dmfe_board_info *); static void update_cr6(u32, unsigned long); @@ -726,7 +726,7 @@ static int dmfe_stop(struct DEVICE *dev) * receive the packet to upper layer, free the transmitted packet */ -static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct DEVICE *dev = dev_id; struct dmfe_board_info *db = (struct dmfe_board_info *) dev->priv; @@ -737,7 +737,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (!dev) { DMFE_DBUG(1, "dmfe_interrupt() without DEVICE arg", 0); - return; + return IRQ_NONE; } spin_lock_irqsave(&db->lock, flags); @@ -747,7 +747,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) outl(db->cr5_data, ioaddr + DCR5); if ( !(db->cr5_data & 0xc1) ) { spin_unlock_irqrestore(&db->lock, flags); - return; + return IRQ_HANDLED; } /* Disable all interrupt in CR7 to solve the interrupt edge problem */ @@ -760,7 +760,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) db->reset_fatal++; db->wait_reset = 1; /* Need to RESET */ spin_unlock_irqrestore(&db->lock, flags); - return; + return IRQ_HANDLED; } /* Received the coming packet */ @@ -786,6 +786,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs) outl(db->cr7_data, ioaddr + DCR7); spin_unlock_irqrestore(&db->lock, flags); + return IRQ_HANDLED; } diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c index a64472c6670b..0a5f6d9b84d2 100644 --- a/drivers/net/tulip/interrupt.c +++ b/drivers/net/tulip/interrupt.c @@ -291,7 +291,7 @@ throttle: #endif } -static inline void phy_interrupt (struct net_device *dev) +static inline unsigned int phy_interrupt (struct net_device *dev) { #ifdef __hppa__ int csr12 = inl(dev->base_addr + CSR12) & 0xff; @@ -307,13 +307,17 @@ static inline void phy_interrupt (struct net_device *dev) spin_unlock(&tp->lock); /* clear irq ack bit */ outl(csr12 & ~0x02, dev->base_addr + CSR12); + + return 1; } #endif + + return 0; } /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -void tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_instance; struct tulip_private *tp = (struct tulip_private *)dev->priv; @@ -328,15 +332,16 @@ void tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs) int maxtx = TX_RING_SIZE; int maxoi = TX_RING_SIZE; unsigned int work_count = tulip_max_interrupt_work; + unsigned int handled = 0; /* Let's see whether the interrupt really is for us */ csr5 = inl(ioaddr + CSR5); - if (tp->flags & HAS_PHY_IRQ) - phy_interrupt (dev); + if (tp->flags & HAS_PHY_IRQ) + handled = phy_interrupt (dev); if ((csr5 & (NormalIntr|AbnormalIntr)) == 0) - return; + return IRQ_RETVAL(handled); tp->nir++; @@ -578,4 +583,5 @@ void tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs) printk(KERN_DEBUG "%s: exiting interrupt, csr5=%#4.4x.\n", dev->name, inl(ioaddr + CSR5)); + return IRQ_HANDLED; } diff --git a/drivers/net/tulip/tulip.h b/drivers/net/tulip/tulip.h index 435dc66c60a8..9f4289bd3a17 100644 --- a/drivers/net/tulip/tulip.h +++ b/drivers/net/tulip/tulip.h @@ -423,7 +423,7 @@ int tulip_read_eeprom(long ioaddr, int location, int addr_len); /* interrupt.c */ extern unsigned int tulip_max_interrupt_work; extern int tulip_rx_copybreak; -void tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +irqreturn_t tulip_interrupt(int irq, void *dev_instance, struct pt_regs *regs); int tulip_refill_rx(struct net_device *dev); /* media.c */ diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 04c89f62aea6..060a376ebec3 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c @@ -385,7 +385,7 @@ static void tx_timeout(struct net_device *dev); static int alloc_ringdesc(struct net_device *dev); static void free_ringdesc(struct netdev_private *np); static int start_tx(struct sk_buff *skb, struct net_device *dev); -static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs); static void netdev_error(struct net_device *dev, int intr_status); static int netdev_rx(struct net_device *dev); static u32 __set_rx_mode(struct net_device *dev); @@ -1165,15 +1165,16 @@ static void netdev_tx_done(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *)dev_instance; struct netdev_private *np = dev->priv; long ioaddr = dev->base_addr; int work_limit = max_interrupt_work; + int handled = 0; if (!netif_device_present(dev)) - return; + return IRQ_NONE; do { u32 intr_status = readl(ioaddr + IntrStatus); @@ -1187,6 +1188,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if ((intr_status & (NormalIntr|AbnormalIntr)) == 0) break; + handled = 1; + if (intr_status & (IntrRxDone | RxNoBuf)) netdev_rx(dev); if (intr_status & RxNoBuf) @@ -1222,6 +1225,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs) if (debug > 3) printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", dev->name, (int)readl(ioaddr + IntrStatus)); + return IRQ_RETVAL(handled); } /* This routine is logically part of the interrupt handler, but separated diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c index 95fea6ea9cd1..3acf64b11c62 100644 --- a/drivers/net/tulip/xircom_cb.c +++ b/drivers/net/tulip/xircom_cb.c @@ -111,7 +111,7 @@ struct xircom_private { /* Function prototypes */ static int xircom_probe(struct pci_dev *pdev, const struct pci_device_id *id); static void xircom_remove(struct pci_dev *pdev); -static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); static int xircom_open(struct net_device *dev); static int xircom_close(struct net_device *dev); @@ -344,7 +344,7 @@ static void __devexit xircom_remove(struct pci_dev *pdev) leave("xircom_remove"); } -static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = (struct net_device *) dev_instance; struct xircom_private *card = (struct xircom_private *) dev->priv; @@ -388,6 +388,7 @@ static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) spin_unlock(&card->lock); leave("xircom_interrupt"); + return IRQ_HANDLED; } static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev) diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index 393537705c89..56a05a62940a 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c @@ -340,7 +340,7 @@ static void xircom_tx_timeout(struct net_device *dev); static void xircom_init_ring(struct net_device *dev); static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev); static int xircom_rx(struct net_device *dev); -static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int xircom_close(struct net_device *dev); static struct net_device_stats *xircom_get_stats(struct net_device *dev); static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); @@ -355,7 +355,7 @@ static void outl_CSR6(u32 newcsr6, long ioaddr) const int strict_bits = TxThresh10 | TxStoreForw | TxThreshMask | EnableTxRx | FullDuplexBit; int csr5, csr5_22_20, csr5_19_17, currcsr6, attempts = 200; - long flags; + unsigned long flags; save_flags(flags); cli(); /* mask out the reserved bits that always read 0 on the Xircom cards */ @@ -1054,12 +1054,13 @@ static void check_duplex(struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = dev_instance; struct xircom_private *tp = dev->priv; long ioaddr = dev->base_addr; int csr5, work_budget = max_interrupt_work; + int handled = 0; spin_lock (&tp->lock); @@ -1078,6 +1079,8 @@ static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) if ((csr5 & (NormalIntr|AbnormalIntr)) == 0) break; + handled = 1; + if (csr5 & (RxIntr | RxNoBuf)) work_budget -= xircom_rx(dev); @@ -1185,6 +1188,7 @@ static void xircom_interrupt(int irq, void *dev_instance, struct pt_regs *regs) dev->name, inl(ioaddr + CSR5)); spin_unlock (&tp->lock); + return IRQ_RETVAL(handled); } @@ -1461,7 +1465,7 @@ static int xircom_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) struct xircom_private *tp = dev->priv; u16 *data = (u16 *)&rq->ifr_data; int phy = tp->phys[0] & 0x1f; - long flags; + unsigned long flags; switch(cmd) { case SIOCETHTOOL: diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c index 6a6a8eb72c10..b15e992aa2c9 100644 --- a/drivers/net/typhoon.c +++ b/drivers/net/typhoon.c @@ -1790,7 +1790,7 @@ typhoon_poll(struct net_device *dev, int *total_budget) return (done ? 0 : 1); } -static void +static irqreturn_t typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = (struct net_device *) dev_instance; @@ -1799,7 +1799,7 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS); if(!intr_status) - return; + return IRQ_NONE; writel(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS); @@ -1811,6 +1811,7 @@ typhoon_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) printk(KERN_ERR "%s: Error, poll already scheduled\n", dev->name); } + return IRQ_HANDLED; } static void diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c index 0bfc3da5480b..1fb8e6f7c76e 100644 --- a/drivers/net/via-rhine.c +++ b/drivers/net/via-rhine.c @@ -530,7 +530,7 @@ static void via_rhine_check_duplex(struct net_device *dev); static void via_rhine_timer(unsigned long data); static void via_rhine_tx_timeout(struct net_device *dev); static int via_rhine_start_tx(struct sk_buff *skb, struct net_device *dev); -static void via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static void via_rhine_tx(struct net_device *dev); static void via_rhine_rx(struct net_device *dev); static void via_rhine_error(struct net_device *dev, int intr_status); @@ -1330,16 +1330,19 @@ static int via_rhine_start_tx(struct sk_buff *skb, struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) +static irqreturn_t via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *rgs) { struct net_device *dev = dev_instance; long ioaddr; u32 intr_status; int boguscnt = max_interrupt_work; + int handled = 0; ioaddr = dev->base_addr; while ((intr_status = get_intr_status(dev))) { + handled = 1; + /* Acknowledge all of the current interrupt sources ASAP. */ if (intr_status & IntrTxDescRace) writeb(0x08, ioaddr + IntrStatus2); @@ -1385,6 +1388,7 @@ static void via_rhine_interrupt(int irq, void *dev_instance, struct pt_regs *rgs if (debug > 3) printk(KERN_DEBUG "%s: exiting interrupt, status=%8.8x.\n", dev->name, readw(ioaddr + IntrStatus)); + return IRQ_RETVAL(handled); } /* This routine is logically part of the interrupt handler, but isolated diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index f402e4305ed0..26ed1b7dee01 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -947,7 +947,7 @@ static u16 transmit_allocate(struct airo_info*, int lenPayload, int raw); static int transmit_802_3_packet(struct airo_info*, int len, char *pPacket); static int transmit_802_11_packet(struct airo_info*, int len, char *pPacket); -static void airo_interrupt( int irq, void* dev_id, struct pt_regs +static irqreturn_t airo_interrupt( int irq, void* dev_id, struct pt_regs *regs); static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); #ifdef WIRELESS_EXT @@ -1837,20 +1837,23 @@ static void airo_read_mic(struct airo_info *ai) { } } -static void airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) { +static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; u16 status; u16 fid; struct airo_info *apriv = dev->priv; u16 savedInterrupts = 0; + int handled = 0; if (!netif_device_present(dev)) - return; + return IRQ_NONE; for (;;) { status = IN4500( apriv, EVSTAT ); if ( !(status & STATUS_INTS) || status == 0xffff ) break; + handled = 1; + if ( status & EV_AWAKE ) { OUT4500( apriv, EVACK, EV_AWAKE ); OUT4500( apriv, EVACK, EV_AWAKE ); @@ -2133,7 +2136,7 @@ static void airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs) { OUT4500( apriv, EVINTEN, savedInterrupts ); /* done.. */ - return; + return IRQ_RETVAL(handled); } /* @@ -2494,7 +2497,7 @@ static int aux_bap_read(struct airo_info *ai, u16 *pu16Dst, u16 next; int words; int i; - long flags; + unsigned long flags; spin_lock_irqsave(&ai->aux_lock, flags); page = IN4500(ai, SWS0+whichbap); diff --git a/drivers/net/wireless/arlan.c b/drivers/net/wireless/arlan.c index eebd299c1dd9..2bddbef9cd0c 100644 --- a/drivers/net/wireless/arlan.c +++ b/drivers/net/wireless/arlan.c @@ -113,7 +113,7 @@ static int arlans_found; static int arlan_probe_here(struct net_device *dev, int ioaddr); static int arlan_open(struct net_device *dev); static int arlan_tx(struct sk_buff *skb, struct net_device *dev); -static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs); static int arlan_close(struct net_device *dev); static struct net_device_stats * arlan_statistics (struct net_device *dev); @@ -1840,7 +1840,7 @@ end_int_process: return; } -static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; struct arlan_private *priv = (struct arlan_private *) dev->priv; @@ -1859,7 +1859,7 @@ static void arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs) priv->irq_test_done = 1; ARLAN_DEBUG_EXIT("arlan_interrupt"); - return; + return IRQ_HANDLED; } diff --git a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h index 198583664a35..3a6fe9c6b6ca 100644 --- a/drivers/net/wireless/arlan.h +++ b/drivers/net/wireless/arlan.h @@ -376,7 +376,7 @@ struct arlan_private { volatile int txNew; volatile int txOffset; volatile char ReTransmitRequested; - volatile long long tx_done_delayed; + volatile unsigned long tx_done_delayed; volatile long long registrationLastSeen; volatile char under_command; volatile char under_toggle; diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index c2a9874882d7..afc650181be4 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c @@ -495,6 +495,7 @@ static dev_link_t *netwave_attach(void) spin_lock_init(&priv->spinlock); /* Netwave specific entries in the device structure */ + SET_MODULE_OWNER(dev); dev->hard_start_xmit = &netwave_start_xmit; dev->set_config = &netwave_config; dev->get_stats = &netwave_get_stats; @@ -1727,7 +1728,6 @@ static int netwave_open(struct net_device *dev) { return -ENODEV; link->open++; - MOD_INC_USE_COUNT; netif_start_queue(dev); netwave_reset(dev); @@ -1746,7 +1746,6 @@ static int netwave_close(struct net_device *dev) { if (link->state & DEV_STALE_CONFIG) mod_timer(&link->release, jiffies + HZ/20); - MOD_DEC_USE_COUNT; return 0; } diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index c2d12d4440b9..8d33bdd304b9 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -1337,7 +1337,7 @@ static void show_rx_frame(struct orinoco_rxframe_hdr *frame) /* * Interrupt handler */ -void orinoco_interrupt(int irq, void *dev_id, struct pt_regs *regs) +irqreturn_t orinoco_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct orinoco_private *priv = (struct orinoco_private *) dev_id; hermes_t *hw = &priv->hw; @@ -1353,7 +1353,7 @@ void orinoco_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (orinoco_lock(priv, &flags) != 0) { /* If hw is unavailable */ - return; + return IRQ_NONE; } evstat = hermes_read_regn(hw, EVSTAT); @@ -1403,6 +1403,8 @@ much! Shutting down.\n", }; orinoco_unlock(priv, &flags); + + return IRQ_HANDLED; } static void __orinoco_ev_tick(struct orinoco_private *priv, hermes_t *hw) diff --git a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h index 8608626def40..5ffcce3cba6d 100644 --- a/drivers/net/wireless/orinoco.h +++ b/drivers/net/wireless/orinoco.h @@ -114,7 +114,7 @@ int orinoco_reinit_firmware(struct net_device *dev); extern int orinoco_proc_dev_init(struct net_device *dev); extern void orinoco_proc_dev_cleanup(struct net_device *dev); -extern void orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs); +extern irqreturn_t orinoco_interrupt(int irq, void * dev_id, struct pt_regs *regs); /********************************************************************/ /* Locking and synchronization functions */ diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 1459020f1d8f..2d9da068e1a8 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -423,6 +423,7 @@ static dev_link_t *ray_attach(void) dev->set_multicast_list = &set_multicast_list; DEBUG(2,"ray_cs ray_attach calling ether_setup.)\n"); + SET_MODULE_OWNER(dev); ether_setup(dev); dev->init = &ray_dev_init; dev->open = &ray_open; @@ -1724,14 +1725,11 @@ static int ray_open(struct net_device *dev) dev_link_t *link; ray_dev_t *local = (ray_dev_t *)dev->priv; - MOD_INC_USE_COUNT; - DEBUG(1, "ray_open('%s')\n", dev->name); for (link = dev_list; link; link = link->next) if (link->priv == dev) break; if (!DEV_OK(link)) { - MOD_DEC_USE_COUNT; return -ENODEV; } @@ -1781,8 +1779,6 @@ static int ray_dev_close(struct net_device *dev) * card is closed we can chage its configuration. * Probably also need a COR reset to get sane state - Jean II */ - MOD_DEC_USE_COUNT; - return 0; } /* end ray_dev_close */ /*===========================================================================*/ diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 7196879d9cf5..57a2fe05d981 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c @@ -3858,7 +3858,7 @@ static int wv_check_ioaddr(unsigned long ioaddr, u8 * mac) * This function is the interrupt handler for the WaveLAN card. This * routine will be called whenever: */ -static void wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs) +static irqreturn_t wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs) { device *dev; unsigned long ioaddr; @@ -3934,7 +3934,7 @@ static void wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs) dev->name, hasr); #endif spin_unlock (&lp->spinlock); - return; + return IRQ_NONE; } /* Read interrupt data. */ @@ -4004,6 +4004,7 @@ static void wavelan_interrupt(int irq, void *dev_id, struct pt_regs *regs) #ifdef DEBUG_INTERRUPT_TRACE printk(KERN_DEBUG "%s: <-wavelan_interrupt()\n", dev->name); #endif + return IRQ_HANDLED; } /*------------------------------------------------------------------*/ diff --git a/drivers/net/wireless/wavelan.p.h b/drivers/net/wireless/wavelan.p.h index cff7e6556701..e5519936a5de 100644 --- a/drivers/net/wireless/wavelan.p.h +++ b/drivers/net/wireless/wavelan.p.h @@ -650,7 +650,7 @@ static int wv_check_ioaddr(u_long, /* ioaddr */ u_char *); /* mac address (read) */ /* ---------------------- INTERRUPT HANDLING ---------------------- */ -static void +static irqreturn_t wavelan_interrupt(int, /* interrupt handler */ void *, struct pt_regs *); diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 3717d9d2588d..f44f09362126 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c @@ -5020,7 +5020,6 @@ wavelan_open(device * dev) /* Mark the device as used */ link->open++; - MOD_INC_USE_COUNT; #ifdef WAVELAN_ROAMING if(do_roaming) @@ -5065,7 +5064,6 @@ wavelan_close(device * dev) #endif /* WAVELAN_ROAMING */ link->open--; - MOD_DEC_USE_COUNT; /* If the card is still present */ if(netif_running(dev)) @@ -5186,6 +5184,7 @@ wavelan_attach(void) ether_setup(dev); /* wavelan NET3 callbacks */ + SET_MODULE_OWNER(dev); dev->open = &wavelan_open; dev->stop = &wavelan_close; dev->hard_start_xmit = &wavelan_packet_xmit; diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 368aed40e280..c4d6785dfb56 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c @@ -406,7 +406,7 @@ static void yellowfin_timer(unsigned long data); static void yellowfin_tx_timeout(struct net_device *dev); static void yellowfin_init_ring(struct net_device *dev); static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev); -static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs); +static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs); static int yellowfin_rx(struct net_device *dev); static void yellowfin_error(struct net_device *dev, int intr_status); static int yellowfin_close(struct net_device *dev); @@ -942,17 +942,18 @@ static int yellowfin_start_xmit(struct sk_buff *skb, struct net_device *dev) /* The interrupt handler does all of the Rx thread work and cleans up after the Tx thread. */ -static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs) +static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct net_device *dev = dev_instance; struct yellowfin_private *yp; long ioaddr; int boguscnt = max_interrupt_work; + unsigned int handled = 0; #ifndef final_version /* Can never occur. */ if (dev == NULL) { printk (KERN_ERR "yellowfin_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } #endif @@ -970,6 +971,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg if (intr_status == 0) break; + handled = 1; if (intr_status & (IntrRxDone | IntrEarlyRx)) { yellowfin_rx(dev); @@ -1091,7 +1093,7 @@ static void yellowfin_interrupt(int irq, void *dev_instance, struct pt_regs *reg dev->name, inw(ioaddr + IntrStatus)); spin_unlock (&yp->lock); - return; + return IRQ_RETVAL(handled); } /* This routine is logically part of the interrupt handler, but separated @@ -1371,18 +1373,20 @@ static void set_rx_mode(struct net_device *dev) memset(hash_table, 0, sizeof(hash_table)); for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; i++, mclist = mclist->next) { + unsigned int bit; + /* Due to a bug in the early chip versions, multiple filter slots must be set for each address. */ if (yp->drv_flags & HasMulticastBug) { - set_bit((ether_crc_le(3, mclist->dmi_addr) >> 3) & 0x3f, - hash_table); - set_bit((ether_crc_le(4, mclist->dmi_addr) >> 3) & 0x3f, - hash_table); - set_bit((ether_crc_le(5, mclist->dmi_addr) >> 3) & 0x3f, - hash_table); + bit = (ether_crc_le(3, mclist->dmi_addr) >> 3) & 0x3f; + hash_table[bit >> 4] |= (1 << bit); + bit = (ether_crc_le(4, mclist->dmi_addr) >> 3) & 0x3f; + hash_table[bit >> 4] |= (1 << bit); + bit = (ether_crc_le(5, mclist->dmi_addr) >> 3) & 0x3f; + hash_table[bit >> 4] |= (1 << bit); } - set_bit((ether_crc_le(6, mclist->dmi_addr) >> 3) & 0x3f, - hash_table); + bit = (ether_crc_le(6, mclist->dmi_addr) >> 3) & 0x3f; + hash_table[bit >> 4] |= (1 << bit); } /* Copy the hash table to the chip. */ for (i = 0; i < 4; i++) diff --git a/drivers/net/znet.c b/drivers/net/znet.c index d529122aa9e5..741a223f293e 100644 --- a/drivers/net/znet.c +++ b/drivers/net/znet.c @@ -159,7 +159,7 @@ struct netidblk { static int znet_open(struct net_device *dev); static int znet_send_packet(struct sk_buff *skb, struct net_device *dev); -static void znet_interrupt(int irq, void *dev_id, struct pt_regs *regs); +static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs *regs); static void znet_rx(struct net_device *dev); static int znet_close(struct net_device *dev); static struct net_device_stats *net_get_stats(struct net_device *dev); @@ -604,16 +604,17 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev) } /* The ZNET interrupt handler. */ -static void znet_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; struct znet_private *znet = dev->priv; int ioaddr; int boguscnt = 20; + int handled = 0; if (dev == NULL) { printk(KERN_WARNING "znet_interrupt(): IRQ %d for unknown device.\n", irq); - return; + return IRQ_NONE; } spin_lock (&znet->lock); @@ -637,6 +638,8 @@ static void znet_interrupt(int irq, void *dev_id, struct pt_regs * regs) if ((status & SR0_INTERRUPT) == 0) break; + handled = 1; + if ((status & SR0_EVENT_MASK) == SR0_TRANSMIT_DONE || (status & SR0_EVENT_MASK) == SR0_RETRANSMIT_DONE || (status & SR0_EVENT_MASK) == SR0_TRANSMIT_NO_CRC_DONE) { @@ -682,7 +685,7 @@ static void znet_interrupt(int irq, void *dev_id, struct pt_regs * regs) spin_unlock (&znet->lock); - return; + return IRQ_RETVAL(handled); } static void znet_rx(struct net_device *dev) diff --git a/include/linux/eeprom.h b/include/linux/eeprom.h index 0f0642271857..ddd37b8ce903 100644 --- a/include/linux/eeprom.h +++ b/include/linux/eeprom.h @@ -59,7 +59,7 @@ void setup_ee_mem_bitbanger(struct eeprom *ee, long memaddr, int eesel_bit, int /* foo. put this in a .c file */ static inline void eeprom_update(struct eeprom *ee, u32 mask, int pol) { - long flags; + unsigned long flags; u32 data; spin_lock_irqsave(ee->lock, flags); |
