Commit 86ba4c15 authored by Jeff Garzik's avatar Jeff Garzik

net driver cleanup, volume 3

Affected drivers: 8139cp, 8139too, 82596, b44, cs89x0, dl2k, r8169

Vast majority of changes contributed by Andrew Morton.
parent 112b6cf7
......@@ -658,7 +658,8 @@ static void cp_rx (struct cp_private *cp)
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)
......
......@@ -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);
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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,11 +1401,12 @@ 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
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment