Commit ee1e4607 authored by Jeff Garzik's avatar Jeff Garzik

net driver cleanup, volume 1:

Mostly updating to new irqreturn_t, but also includes some needed
SET_MODULE_OWNER and set_bit cleanups as well.

Affects: 8390, dgrs, eepro100, epic100, pcnet32, rcpci45,
sis900, tlan
parent 2f4734ea
......@@ -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;
}
/**
......
......@@ -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 {
......
......@@ -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;
}
/*
......
......@@ -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)
......
......@@ -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);
......@@ -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))) {
......
......@@ -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;
}
......
......@@ -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;
}
/*
......
......@@ -422,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
......
......@@ -107,7 +107,7 @@ 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);
......@@ -635,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)
{
......@@ -648,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
......
......@@ -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 */
......
......@@ -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 */
......
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