Commit 28fc1f5a0c375cb6375fa48e9a8b393f2a189be6

Authored by Jeff Garzik
Committed by David S. Miller
1 parent 1b36efe07f

[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 <jgarzik@redhat.com>

Showing 19 changed files with 40 additions and 74 deletions Side-by-side Diff

arch/ia64/hp/sim/simeth.c
... ... @@ -497,11 +497,6 @@
497 497 {
498 498 struct net_device *dev = dev_id;
499 499  
500   - if ( dev == NULL ) {
501   - printk(KERN_WARNING "simeth: irq %d for unknown device\n", irq);
502   - return IRQ_NONE;
503   - }
504   -
505 500 /*
506 501 * very simple loop because we get interrupts only when receiving
507 502 */
arch/ppc/8260_io/enet.c
... ... @@ -272,7 +272,7 @@
272 272 * This is called from the CPM handler, not the MPC core interrupt.
273 273 */
274 274 static irqreturn_t
275   -scc_enet_interrupt(int irq, void * dev_id)
  275 +scc_enet_interrupt(int irq, void *dev_id)
276 276 {
277 277 struct net_device *dev = dev_id;
278 278 volatile struct scc_enet_private *cep;
... ... @@ -280,7 +280,7 @@
280 280 ushort int_events;
281 281 int must_restart;
282 282  
283   - cep = (struct scc_enet_private *)dev->priv;
  283 + cep = dev->priv;
284 284  
285 285 /* Get the interrupt events that caused us to be here.
286 286 */
arch/ppc/8260_io/fcc_enet.c
... ... @@ -524,7 +524,7 @@
524 524  
525 525 /* The interrupt handler. */
526 526 static irqreturn_t
527   -fcc_enet_interrupt(int irq, void * dev_id)
  527 +fcc_enet_interrupt(int irq, void *dev_id)
528 528 {
529 529 struct net_device *dev = dev_id;
530 530 volatile struct fcc_enet_private *cep;
... ... @@ -532,7 +532,7 @@
532 532 ushort int_events;
533 533 int must_restart;
534 534  
535   - cep = (struct fcc_enet_private *)dev->priv;
  535 + cep = dev->priv;
536 536  
537 537 /* Get the interrupt events that caused us to be here.
538 538 */
... ... @@ -661,9 +661,6 @@
661 661 int queue;
662 662 u32 status;
663 663  
664   - if (!dev)
665   - return IRQ_NONE;
666   -
667 664 priv = netdev_priv(dev);
668 665  
669 666 status = cpmac_read(priv->regs, CPMAC_MAC_INT_VECTOR);
drivers/net/declance.c
... ... @@ -719,15 +719,15 @@
719 719 spin_unlock(&lp->lock);
720 720 }
721 721  
722   -static irqreturn_t lance_dma_merr_int(const int irq, void *dev_id)
  722 +static irqreturn_t lance_dma_merr_int(int irq, void *dev_id)
723 723 {
724 724 struct net_device *dev = dev_id;
725 725  
726   - printk("%s: DMA error\n", dev->name);
  726 + printk(KERN_ERR "%s: DMA error\n", dev->name);
727 727 return IRQ_HANDLED;
728 728 }
729 729  
730   -static irqreturn_t lance_interrupt(const int irq, void *dev_id)
  730 +static irqreturn_t lance_interrupt(int irq, void *dev_id)
731 731 {
732 732 struct net_device *dev = dev_id;
733 733 struct lance_private *lp = netdev_priv(dev);
drivers/net/eexpress.c
... ... @@ -456,8 +456,9 @@
456 456 if (!dev->irq || !irqrmap[dev->irq])
457 457 return -ENXIO;
458 458  
459   - ret = request_irq(dev->irq,&eexp_irq,0,dev->name,dev);
460   - if (ret) return ret;
  459 + ret = request_irq(dev->irq, &eexp_irq, 0, dev->name, dev);
  460 + if (ret)
  461 + return ret;
461 462  
462 463 if (!request_region(ioaddr, EEXP_IO_EXTENT, "EtherExpress")) {
463 464 printk(KERN_WARNING "EtherExpress io port %x, is busy.\n"
... ... @@ -768,7 +769,7 @@
768 769 }
769 770 }
770 771  
771   -static irqreturn_t eexp_irq(int irq, void *dev_info)
  772 +static irqreturn_t eexp_irq(int dummy, void *dev_info)
772 773 {
773 774 struct net_device *dev = dev_info;
774 775 struct net_local *lp;
... ... @@ -783,7 +784,7 @@
783 784 old_read_ptr = inw(ioaddr+READ_PTR);
784 785 old_write_ptr = inw(ioaddr+WRITE_PTR);
785 786  
786   - outb(SIRQ_dis|irqrmap[irq],ioaddr+SET_IRQ);
  787 + outb(SIRQ_dis|irqrmap[dev->irq],ioaddr+SET_IRQ);
787 788  
788 789  
789 790 status = scb_status(dev);
... ... @@ -851,7 +852,7 @@
851 852  
852 853 eexp_cmd_clear(dev);
853 854  
854   - outb(SIRQ_en|irqrmap[irq],ioaddr+SET_IRQ);
  855 + outb(SIRQ_en|irqrmap[dev->irq],ioaddr+SET_IRQ);
855 856  
856 857 #if NET_DEBUG > 6
857 858 printk("%s: leaving eexp_irq()\n", dev->name);
drivers/net/ibmlana.c
... ... @@ -704,9 +704,9 @@
704 704  
705 705 /* general interrupt entry */
706 706  
707   -static irqreturn_t irq_handler(int irq, void *device)
  707 +static irqreturn_t irq_handler(int dummy, void *device)
708 708 {
709   - struct net_device *dev = (struct net_device *) device;
  709 + struct net_device *dev = device;
710 710 u16 ival;
711 711  
712 712 /* in case we're not meant... */
drivers/net/irda/irport.h
... ... @@ -74,7 +74,7 @@
74 74 /* For piggyback drivers */
75 75 void *priv;
76 76 void (*change_speed)(void *priv, __u32 speed);
77   - irqreturn_t (*interrupt)(int irq, void *dev_id);
  77 + irq_handler_t interrupt;
78 78 };
79 79  
80 80 #endif /* IRPORT_H */
drivers/net/irda/smsc-ircc2.c
... ... @@ -1505,22 +1505,13 @@
1505 1505 * An interrupt from the chip has arrived. Time to do some work
1506 1506 *
1507 1507 */
1508   -static irqreturn_t smsc_ircc_interrupt(int irq, void *dev_id)
  1508 +static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
1509 1509 {
1510   - struct net_device *dev = (struct net_device *) dev_id;
1511   - struct smsc_ircc_cb *self;
  1510 + struct net_device *dev = dev_id;
  1511 + struct smsc_ircc_cb *self = netdev_priv(dev);
1512 1512 int iobase, iir, lcra, lsr;
1513 1513 irqreturn_t ret = IRQ_NONE;
1514 1514  
1515   - if (dev == NULL) {
1516   - printk(KERN_WARNING "%s: irq %d for unknown device.\n",
1517   - driver_name, irq);
1518   - goto irq_ret;
1519   - }
1520   -
1521   - self = netdev_priv(dev);
1522   - IRDA_ASSERT(self != NULL, return IRQ_NONE;);
1523   -
1524 1515 /* Serialise the interrupt handler in various CPUs, stop Tx path */
1525 1516 spin_lock(&self->lock);
1526 1517  
... ... @@ -1565,7 +1556,7 @@
1565 1556  
1566 1557 irq_ret_unlock:
1567 1558 spin_unlock(&self->lock);
1568   - irq_ret:
  1559 +
1569 1560 return ret;
1570 1561 }
1571 1562  
drivers/net/irda/via-ircc.c
... ... @@ -1346,19 +1346,13 @@
1346 1346 * An interrupt from the chip has arrived. Time to do some work
1347 1347 *
1348 1348 */
1349   -static irqreturn_t via_ircc_interrupt(int irq, void *dev_id)
  1349 +static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1350 1350 {
1351   - struct net_device *dev = (struct net_device *) dev_id;
1352   - struct via_ircc_cb *self;
  1351 + struct net_device *dev = dev_id;
  1352 + struct via_ircc_cb *self = dev->priv;
1353 1353 int iobase;
1354 1354 u8 iHostIntType, iRxIntType, iTxIntType;
1355 1355  
1356   - if (!dev) {
1357   - IRDA_WARNING("%s: irq %d for unknown device.\n", driver_name,
1358   - irq);
1359   - return IRQ_NONE;
1360   - }
1361   - self = (struct via_ircc_cb *) dev->priv;
1362 1356 iobase = self->io.fir_base;
1363 1357 spin_lock(&self->lock);
1364 1358 iHostIntType = GetHostStatus(iobase);
drivers/net/ixgbe/ixgbe_main.c
... ... @@ -734,7 +734,7 @@
734 734 {
735 735 struct net_device *netdev = adapter->netdev;
736 736 int flags, err;
737   - irqreturn_t(*handler) (int, void *) = &ixgbe_intr;
  737 + irq_handler_t handler = ixgbe_intr;
738 738  
739 739 flags = IRQF_SHARED;
740 740  
drivers/net/lp486e.c
... ... @@ -1144,13 +1144,12 @@
1144 1144 }
1145 1145  
1146 1146 static irqreturn_t
1147   -i596_interrupt (int irq, void *dev_instance) {
1148   - struct net_device *dev = (struct net_device *) dev_instance;
1149   - struct i596_private *lp;
  1147 +i596_interrupt (int irq, void *dev_instance)
  1148 +{
  1149 + struct net_device *dev = dev_instance;
  1150 + struct i596_private *lp = dev->priv;
1150 1151 unsigned short status, ack_cmd = 0;
1151 1152 int frames_in = 0;
1152   -
1153   - lp = (struct i596_private *) dev->priv;
1154 1153  
1155 1154 /*
1156 1155 * The 82596 examines the command, performs the required action,
drivers/net/pcmcia/fmvj18x_cs.c
... ... @@ -731,18 +731,13 @@
731 731  
732 732 /*====================================================================*/
733 733  
734   -static irqreturn_t fjn_interrupt(int irq, void *dev_id)
  734 +static irqreturn_t fjn_interrupt(int dummy, void *dev_id)
735 735 {
736 736 struct net_device *dev = dev_id;
737 737 local_info_t *lp = netdev_priv(dev);
738 738 kio_addr_t ioaddr;
739 739 unsigned short tx_stat, rx_stat;
740 740  
741   - if (lp == NULL) {
742   - printk(KERN_NOTICE "fjn_interrupt(): irq %d for "
743   - "unknown device.\n", irq);
744   - return IRQ_NONE;
745   - }
746 741 ioaddr = dev->base_addr;
747 742  
748 743 /* avoid multiple interrupts */
drivers/net/ucc_geth.c
... ... @@ -3614,9 +3614,6 @@
3614 3614  
3615 3615 ugeth_vdbg("%s: IN", __FUNCTION__);
3616 3616  
3617   - if (!ugeth)
3618   - return IRQ_NONE;
3619   -
3620 3617 uccf = ugeth->uccf;
3621 3618 ug_info = ugeth->ug_info;
3622 3619  
drivers/net/wan/farsync.c
... ... @@ -1498,9 +1498,9 @@
1498 1498 * Dev_id is our fst_card_info pointer
1499 1499 */
1500 1500 static irqreturn_t
1501   -fst_intr(int irq, void *dev_id)
  1501 +fst_intr(int dummy, void *dev_id)
1502 1502 {
1503   - struct fst_card_info *card;
  1503 + struct fst_card_info *card = dev_id;
1504 1504 struct fst_port_info *port;
1505 1505 int rdidx; /* Event buffer indices */
1506 1506 int wridx;
1507 1507  
... ... @@ -1509,17 +1509,12 @@
1509 1509 unsigned int do_card_interrupt;
1510 1510 unsigned int int_retry_count;
1511 1511  
1512   - if ((card = dev_id) == NULL) {
1513   - dbg(DBG_INTR, "intr: spurious %d\n", irq);
1514   - return IRQ_NONE;
1515   - }
1516   -
1517 1512 /*
1518 1513 * Check to see if the interrupt was for this card
1519 1514 * return if not
1520 1515 * Note that the call to clear the interrupt is important
1521 1516 */
1522   - dbg(DBG_INTR, "intr: %d %p\n", irq, card);
  1517 + dbg(DBG_INTR, "intr: %d %p\n", card->irq, card);
1523 1518 if (card->state != FST_RUNNING) {
1524 1519 printk_err
1525 1520 ("Interrupt received for card %d in a non running state (%d)\n",
drivers/net/wan/sdla.c
... ... @@ -867,7 +867,7 @@
867 867 spin_unlock_irqrestore(&sdla_lock, flags);
868 868 }
869 869  
870   -static irqreturn_t sdla_isr(int irq, void *dev_id)
  870 +static irqreturn_t sdla_isr(int dummy, void *dev_id)
871 871 {
872 872 struct net_device *dev;
873 873 struct frad_local *flp;
... ... @@ -879,7 +879,8 @@
879 879  
880 880 if (!flp->initialized)
881 881 {
882   - printk(KERN_WARNING "%s: irq %d for uninitialized device.\n", dev->name, irq);
  882 + printk(KERN_WARNING "%s: irq %d for uninitialized device.\n",
  883 + dev->name, dev->irq);
883 884 return IRQ_NONE;
884 885 }
885 886  
drivers/net/wireless/airo.c
... ... @@ -3177,8 +3177,9 @@
3177 3177 return 0;
3178 3178 }
3179 3179  
3180   -static irqreturn_t airo_interrupt ( int irq, void* dev_id) {
3181   - struct net_device *dev = (struct net_device *)dev_id;
  3180 +static irqreturn_t airo_interrupt(int irq, void *dev_id)
  3181 +{
  3182 + struct net_device *dev = dev_id;
3182 3183 u16 status;
3183 3184 u16 fid;
3184 3185 struct airo_info *apriv = dev->priv;
drivers/net/wireless/hostap/hostap_hw.c
... ... @@ -2624,7 +2624,7 @@
2624 2624 /* Called only from hardware IRQ */
2625 2625 static irqreturn_t prism2_interrupt(int irq, void *dev_id)
2626 2626 {
2627   - struct net_device *dev = (struct net_device *) dev_id;
  2627 + struct net_device *dev = dev_id;
2628 2628 struct hostap_interface *iface;
2629 2629 local_info_t *local;
2630 2630 int events = 0;
drivers/net/wireless/libertas/if_cs.c
... ... @@ -243,7 +243,7 @@
243 243  
244 244 static irqreturn_t if_cs_interrupt(int irq, void *data)
245 245 {
246   - struct if_cs_card *card = (struct if_cs_card *)data;
  246 + struct if_cs_card *card = data;
247 247 u16 int_cause;
248 248  
249 249 lbs_deb_enter(LBS_DEB_CS);