From 28fc1f5a0c375cb6375fa48e9a8b393f2a189be6 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 29 Oct 2007 05:46:16 -0400 Subject: [PATCH] [netdrvr] irq handler minor cleanups in several drivers * use irq_handler_t where appropriate * no need to use 'irq' function arg, its already stored in a data struct * rename irq handler 'irq' argument to 'dummy', where the function has been analyzed and proven not to use its first argument. * remove always-false "dev_id == NULL" test from irq handlers * remove pointless casts from void* * declance: irq argument is not const * add KERN_xxx printk prefix * fix minor whitespace weirdness Signed-off-by: Jeff Garzik --- arch/ia64/hp/sim/simeth.c | 5 ----- arch/ppc/8260_io/enet.c | 4 ++-- arch/ppc/8260_io/fcc_enet.c | 4 ++-- drivers/net/cpmac.c | 3 --- drivers/net/declance.c | 6 +++--- drivers/net/eexpress.c | 11 ++++++----- drivers/net/ibmlana.c | 4 ++-- drivers/net/irda/irport.h | 2 +- drivers/net/irda/smsc-ircc2.c | 17 ++++------------- drivers/net/irda/via-ircc.c | 12 +++--------- drivers/net/ixgbe/ixgbe_main.c | 2 +- drivers/net/lp486e.c | 9 ++++----- drivers/net/pcmcia/fmvj18x_cs.c | 7 +------ drivers/net/ucc_geth.c | 3 --- drivers/net/wan/farsync.c | 11 +++-------- drivers/net/wan/sdla.c | 5 +++-- drivers/net/wireless/airo.c | 5 +++-- drivers/net/wireless/hostap/hostap_hw.c | 2 +- drivers/net/wireless/libertas/if_cs.c | 2 +- 19 files changed, 40 insertions(+), 74 deletions(-) diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index 08b117e2c5..9898febf60 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c @@ -497,11 +497,6 @@ simeth_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; - if ( dev == NULL ) { - printk(KERN_WARNING "simeth: irq %d for unknown device\n", irq); - return IRQ_NONE; - } - /* * very simple loop because we get interrupts only when receiving */ diff --git a/arch/ppc/8260_io/enet.c b/arch/ppc/8260_io/enet.c index 615b6583d9..06bb5b77ea 100644 --- a/arch/ppc/8260_io/enet.c +++ b/arch/ppc/8260_io/enet.c @@ -272,7 +272,7 @@ scc_enet_timeout(struct net_device *dev) * This is called from the CPM handler, not the MPC core interrupt. */ static irqreturn_t -scc_enet_interrupt(int irq, void * dev_id) +scc_enet_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; volatile struct scc_enet_private *cep; @@ -280,7 +280,7 @@ scc_enet_interrupt(int irq, void * dev_id) ushort int_events; int must_restart; - cep = (struct scc_enet_private *)dev->priv; + cep = dev->priv; /* Get the interrupt events that caused us to be here. */ diff --git a/arch/ppc/8260_io/fcc_enet.c b/arch/ppc/8260_io/fcc_enet.c index 6f3ed6a72e..a3a27dafff 100644 --- a/arch/ppc/8260_io/fcc_enet.c +++ b/arch/ppc/8260_io/fcc_enet.c @@ -524,7 +524,7 @@ fcc_enet_timeout(struct net_device *dev) /* The interrupt handler. */ static irqreturn_t -fcc_enet_interrupt(int irq, void * dev_id) +fcc_enet_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; volatile struct fcc_enet_private *cep; @@ -532,7 +532,7 @@ fcc_enet_interrupt(int irq, void * dev_id) ushort int_events; int must_restart; - cep = (struct fcc_enet_private *)dev->priv; + cep = dev->priv; /* Get the interrupt events that caused us to be here. */ diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 6e12d48351..6ccebb830f 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -661,9 +661,6 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id) int queue; u32 status; - if (!dev) - return IRQ_NONE; - priv = netdev_priv(dev); status = cpmac_read(priv->regs, CPMAC_MAC_INT_VECTOR); diff --git a/drivers/net/declance.c b/drivers/net/declance.c index 00e0194bfe..6b1e77cc06 100644 --- a/drivers/net/declance.c +++ b/drivers/net/declance.c @@ -719,15 +719,15 @@ out: spin_unlock(&lp->lock); } -static irqreturn_t lance_dma_merr_int(const int irq, void *dev_id) +static irqreturn_t lance_dma_merr_int(int irq, void *dev_id) { struct net_device *dev = dev_id; - printk("%s: DMA error\n", dev->name); + printk(KERN_ERR "%s: DMA error\n", dev->name); return IRQ_HANDLED; } -static irqreturn_t lance_interrupt(const int irq, void *dev_id) +static irqreturn_t lance_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; struct lance_private *lp = netdev_priv(dev); diff --git a/drivers/net/eexpress.c b/drivers/net/eexpress.c index 70509ed6c1..8969c3b6d4 100644 --- a/drivers/net/eexpress.c +++ b/drivers/net/eexpress.c @@ -456,8 +456,9 @@ static int eexp_open(struct net_device *dev) if (!dev->irq || !irqrmap[dev->irq]) return -ENXIO; - ret = request_irq(dev->irq,&eexp_irq,0,dev->name,dev); - if (ret) return ret; + ret = request_irq(dev->irq, &eexp_irq, 0, dev->name, dev); + if (ret) + return ret; if (!request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress")) { printk(KERN_WARNING "EtherExpress io port %x, is busy.\n" @@ -768,7 +769,7 @@ static void eexp_cmd_clear(struct net_device *dev) } } -static irqreturn_t eexp_irq(int irq, void *dev_info) +static irqreturn_t eexp_irq(int dummy, void *dev_info) { struct net_device *dev = dev_info; struct net_local *lp; @@ -783,7 +784,7 @@ static irqreturn_t eexp_irq(int irq, void *dev_info) old_read_ptr = inw(ioaddr+READ_PTR); old_write_ptr = inw(ioaddr+WRITE_PTR); - outb(SIRQ_dis|irqrmap[irq],ioaddr+SET_IRQ); + outb(SIRQ_dis|irqrmap[dev->irq],ioaddr+SET_IRQ); status = scb_status(dev); @@ -851,7 +852,7 @@ static irqreturn_t eexp_irq(int irq, void *dev_info) eexp_cmd_clear(dev); - outb(SIRQ_en|irqrmap[irq],ioaddr+SET_IRQ); + outb(SIRQ_en|irqrmap[dev->irq],ioaddr+SET_IRQ); #if NET_DEBUG > 6 printk("%s: leaving eexp_irq()\n", dev->name); diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 91d83aca6b..65626d61de 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c @@ -704,9 +704,9 @@ static void irqtxerr_handler(struct net_device *dev) /* general interrupt entry */ -static irqreturn_t irq_handler(int irq, void *device) +static irqreturn_t irq_handler(int dummy, void *device) { - struct net_device *dev = (struct net_device *) device; + struct net_device *dev = device; u16 ival; /* in case we're not meant... */ diff --git a/drivers/net/irda/irport.h b/drivers/net/irda/irport.h index 66fc2433e9..39829cffba 100644 --- a/drivers/net/irda/irport.h +++ b/drivers/net/irda/irport.h @@ -74,7 +74,7 @@ struct irport_cb { /* For piggyback drivers */ void *priv; void (*change_speed)(void *priv, __u32 speed); - irqreturn_t (*interrupt)(int irq, void *dev_id); + irq_handler_t interrupt; }; #endif /* IRPORT_H */ diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 7e7b582821..1f26da761e 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c @@ -1505,22 +1505,13 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self) * An interrupt from the chip has arrived. Time to do some work * */ -static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id) +static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id) { - struct net_device *dev = (struct net_device *) dev_id; - struct smsc_ircc_cb *self; + struct net_device *dev = dev_id; + struct smsc_ircc_cb *self = netdev_priv(dev); int iobase, iir, lcra, lsr; irqreturn_t ret = IRQ_NONE; - if (dev == NULL) { - printk(KERN_WARNING "%s: irq %d for unknown device.\n", - driver_name, irq); - goto irq_ret; - } - - self = netdev_priv(dev); - IRDA_ASSERT(self != NULL, return IRQ_NONE;); - /* Serialise the interrupt handler in various CPUs, stop Tx path */ spin_lock(&self->lock); @@ -1565,7 +1556,7 @@ static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id) irq_ret_unlock: spin_unlock(&self->lock); - irq_ret: + return ret; } diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c index 126ec7c868..58e1287845 100644 --- a/drivers/net/irda/via-ircc.c +++ b/drivers/net/irda/via-ircc.c @@ -1346,19 +1346,13 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase) * An interrupt from the chip has arrived. Time to do some work * */ -static irqreturn_t via_ircc_interrupt(int irq, void *dev_id) +static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id) { - struct net_device *dev = (struct net_device *) dev_id; - struct via_ircc_cb *self; + struct net_device *dev = dev_id; + struct via_ircc_cb *self = dev->priv; int iobase; u8 iHostIntType, iRxIntType, iTxIntType; - if (!dev) { - IRDA_WARNING("%s: irq %d for unknown device.\n", driver_name, - irq); - return IRQ_NONE; - } - self = (struct via_ircc_cb *) dev->priv; iobase = self->io.fir_base; spin_lock(&self->lock); iHostIntType = GetHostStatus(iobase); diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a4265bc1ce..88341bfb56 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -734,7 +734,7 @@ static int ixgbe_request_irq(struct ixgbe_adapter *adapter, u32 *num_rx_queues) { struct net_device *netdev = adapter->netdev; int flags, err; - irqreturn_t(*handler) (int, void *) = &ixgbe_intr; + irq_handler_t handler = ixgbe_intr; flags = IRQF_SHARED; diff --git a/drivers/net/lp486e.c b/drivers/net/lp486e.c index c5095ecd8b..0eff1a00c4 100644 --- a/drivers/net/lp486e.c +++ b/drivers/net/lp486e.c @@ -1144,14 +1144,13 @@ i596_handle_CU_completion(struct net_device *dev, } static irqreturn_t -i596_interrupt (int irq, void *dev_instance) { - struct net_device *dev = (struct net_device *) dev_instance; - struct i596_private *lp; +i596_interrupt (int irq, void *dev_instance) +{ + struct net_device *dev = dev_instance; + struct i596_private *lp = dev->priv; unsigned short status, ack_cmd = 0; int frames_in = 0; - lp = (struct i596_private *) dev->priv; - /* * The 82596 examines the command, performs the required action, * and then clears the SCB command word. diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 8c719b4df5..949c6df74c 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -731,18 +731,13 @@ module_exit(exit_fmvj18x_cs); /*====================================================================*/ -static irqreturn_t fjn_interrupt(int irq, void *dev_id) +static irqreturn_t fjn_interrupt(int dummy, void *dev_id) { struct net_device *dev = dev_id; local_info_t *lp = netdev_priv(dev); kio_addr_t ioaddr; unsigned short tx_stat, rx_stat; - if (lp == NULL) { - printk(KERN_NOTICE "fjn_interrupt(): irq %d for " - "unknown device.\n", irq); - return IRQ_NONE; - } ioaddr = dev->base_addr; /* avoid multiple interrupts */ diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index abac7db381..73d6ac9406 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c @@ -3614,9 +3614,6 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info) ugeth_vdbg("%s: IN", __FUNCTION__); - if (!ugeth) - return IRQ_NONE; - uccf = ugeth->uccf; ug_info = ugeth->ug_info; diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 12dae8e248..cf27bf40d3 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c @@ -1498,9 +1498,9 @@ do_bottom_half_rx(struct fst_card_info *card) * Dev_id is our fst_card_info pointer */ static irqreturn_t -fst_intr(int irq, void *dev_id) +fst_intr(int dummy, void *dev_id) { - struct fst_card_info *card; + struct fst_card_info *card = dev_id; struct fst_port_info *port; int rdidx; /* Event buffer indices */ int wridx; @@ -1509,17 +1509,12 @@ fst_intr(int irq, void *dev_id) unsigned int do_card_interrupt; unsigned int int_retry_count; - if ((card = dev_id) == NULL) { - dbg(DBG_INTR, "intr: spurious %d\n", irq); - return IRQ_NONE; - } - /* * Check to see if the interrupt was for this card * return if not * Note that the call to clear the interrupt is important */ - dbg(DBG_INTR, "intr: %d %p\n", irq, card); + dbg(DBG_INTR, "intr: %d %p\n", card->irq, card); if (card->state != FST_RUNNING) { printk_err ("Interrupt received for card %d in a non running state (%d)\n", diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index 05df0a345b..73e2f27809 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -867,7 +867,7 @@ static void sdla_receive(struct net_device *dev) spin_unlock_irqrestore(&sdla_lock, flags); } -static irqreturn_t sdla_isr(int irq, void *dev_id) +static irqreturn_t sdla_isr(int dummy, void *dev_id) { struct net_device *dev; struct frad_local *flp; @@ -879,7 +879,8 @@ static irqreturn_t sdla_isr(int irq, void *dev_id) if (!flp->initialized) { - printk(KERN_WARNING "%s: irq %d for uninitialized device.\n", dev->name, irq); + printk(KERN_WARNING "%s: irq %d for uninitialized device.\n", + dev->name, dev->irq); return IRQ_NONE; } diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index e3eca6d047..d8948bf8a2 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -3177,8 +3177,9 @@ static int airo_thread(void *data) { return 0; } -static irqreturn_t airo_interrupt ( int irq, void* dev_id) { - struct net_device *dev = (struct net_device *)dev_id; +static irqreturn_t airo_interrupt(int irq, void *dev_id) +{ + struct net_device *dev = dev_id; u16 status; u16 fid; struct airo_info *apriv = dev->priv; diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c index c592641e91..286b46c516 100644 --- a/drivers/net/wireless/hostap/hostap_hw.c +++ b/drivers/net/wireless/hostap/hostap_hw.c @@ -2624,7 +2624,7 @@ static void prism2_check_magic(local_info_t *local) /* Called only from hardware IRQ */ static irqreturn_t prism2_interrupt(int irq, void *dev_id) { - struct net_device *dev = (struct net_device *) dev_id; + struct net_device *dev = dev_id; struct hostap_interface *iface; local_info_t *local; int events = 0; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index ba4fc2b3bf..d383c0f9fe 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -243,7 +243,7 @@ static inline void if_cs_disable_ints(struct if_cs_card *card) static irqreturn_t if_cs_interrupt(int irq, void *data) { - struct if_cs_card *card = (struct if_cs_card *)data; + struct if_cs_card *card = data; u16 int_cause; lbs_deb_enter(LBS_DEB_CS); -- 2.39.5