Commit 112b6cf7 authored by Jeff Garzik's avatar Jeff Garzik

net driver cleanup, volume 2

morq irqreturn_t,
some s/long flags/unsigned long flags/,
more set_bit-on-something-other-than-long cleanups

Affected drivers: epic100, fealnx, natsemi, ns83820, starfire,
sundance, via-rhine, yellowfin.  (and also include/linux/eeprom.h)

Several changes contributed by Andrew Morton.
parent ee1e4607
......@@ -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);
......
......@@ -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;
}
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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
......
......@@ -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++)
......
......@@ -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);
......
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