Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Jeff Garzik and committed by
David S. Miller
28fc1f5a 1b36efe0

+40 -74
-5
arch/ia64/hp/sim/simeth.c
··· 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 */
+2 -2
arch/ppc/8260_io/enet.c
··· 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 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 */
+2 -2
arch/ppc/8260_io/fcc_enet.c
··· 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 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 */
-3
drivers/net/cpmac.c
··· 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);
+3 -3
drivers/net/declance.c
··· 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);
+6 -5
drivers/net/eexpress.c
··· 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" ··· 769 768 } 770 769 } 771 770 772 - static irqreturn_t eexp_irq(int irq, void *dev_info) 771 + static irqreturn_t eexp_irq(int dummy, void *dev_info) 773 772 { 774 773 struct net_device *dev = dev_info; 775 774 struct net_local *lp; ··· 784 783 old_read_ptr = inw(ioaddr+READ_PTR); 785 784 old_write_ptr = inw(ioaddr+WRITE_PTR); 786 785 787 - outb(SIRQ_dis|irqrmap[irq],ioaddr+SET_IRQ); 786 + outb(SIRQ_dis|irqrmap[dev->irq],ioaddr+SET_IRQ); 788 787 789 788 790 789 status = scb_status(dev); ··· 852 851 853 852 eexp_cmd_clear(dev); 854 853 855 - outb(SIRQ_en|irqrmap[irq],ioaddr+SET_IRQ); 854 + outb(SIRQ_en|irqrmap[dev->irq],ioaddr+SET_IRQ); 856 855 857 856 #if NET_DEBUG > 6 858 857 printk("%s: leaving eexp_irq()\n", dev->name);
+2 -2
drivers/net/ibmlana.c
··· 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... */
+1 -1
drivers/net/irda/irport.h
··· 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 */
+4 -13
drivers/net/irda/smsc-ircc2.c
··· 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 - 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 1514 1524 1515 /* Serialise the interrupt handler in various CPUs, stop Tx path */ 1525 1516 spin_lock(&self->lock); ··· 1556 1565 1557 1566 irq_ret_unlock: 1558 1567 spin_unlock(&self->lock); 1559 - irq_ret: 1568 + 1560 1569 return ret; 1561 1570 } 1562 1571
+3 -9
drivers/net/irda/via-ircc.c
··· 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);
+1 -1
drivers/net/ixgbe/ixgbe_main.c
··· 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
+4 -5
drivers/net/lp486e.c
··· 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,
+1 -6
drivers/net/pcmcia/fmvj18x_cs.c
··· 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 */
-3
drivers/net/ucc_geth.c
··· 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
+3 -8
drivers/net/wan/farsync.c
··· 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; ··· 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",
+3 -2
drivers/net/wan/sdla.c
··· 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 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
+3 -2
drivers/net/wireless/airo.c
··· 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;
+1 -1
drivers/net/wireless/hostap/hostap_hw.c
··· 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;
+1 -1
drivers/net/wireless/libertas/if_cs.c
··· 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);