]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[netdrvr] irq handler minor cleanups in several drivers
authorJeff Garzik <jeff@garzik.org>
Mon, 29 Oct 2007 09:46:16 +0000 (05:46 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:03:40 +0000 (15:03 -0800)
* 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>
19 files changed:
arch/ia64/hp/sim/simeth.c
arch/ppc/8260_io/enet.c
arch/ppc/8260_io/fcc_enet.c
drivers/net/cpmac.c
drivers/net/declance.c
drivers/net/eexpress.c
drivers/net/ibmlana.c
drivers/net/irda/irport.h
drivers/net/irda/smsc-ircc2.c
drivers/net/irda/via-ircc.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/lp486e.c
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/ucc_geth.c
drivers/net/wan/farsync.c
drivers/net/wan/sdla.c
drivers/net/wireless/airo.c
drivers/net/wireless/hostap/hostap_hw.c
drivers/net/wireless/libertas/if_cs.c

index 08b117e2c54bdade231aa96c29cac4f4ce1bc728..9898febf609a34b8073f288295d1f24446931621 100644 (file)
@@ -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
         */
index 615b6583d9b01084831bd8eea5ed00aecf9ab30b..06bb5b77ea6245ed370dac0251fea8ee92d114e9 100644 (file)
@@ -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.
        */
index 6f3ed6a72e0be3a2c895485824ff8c8ec842e54f..a3a27dafff1fc73fc3d1ebc777213fc3a9819598 100644 (file)
@@ -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.
        */
index 6e12d48351b8e1a4b243efd80b5c669c689e6830..6ccebb830ff90bc86f4b00ed0f622f8fe0c0245b 100644 (file)
@@ -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);
index 00e0194bfef005acea333ed70dd6db7aacc36d37..6b1e77cc069e989b5d48b71911b03f5ed3ddf1f5 100644 (file)
@@ -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);
index 70509ed6c11de9a77cc5cbe14bc86859e136e363..8969c3b6d443f37f46fc60bebaa071b1702061ab 100644 (file)
@@ -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);
index 91d83aca6bc784e886ca15c508dc9125251c2963..65626d61de46c52bcb60b3dd8ed979a61a3f306d 100644 (file)
@@ -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... */
index 66fc2433e97d37377d7c554cb673d5aba2d688c8..39829cffba138928c7d1c63831730af66e1fc8c6 100644 (file)
@@ -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 */
index 7e7b5828214a89fa12e587f3b3fc0a31aa27e54b..1f26da761e9f0067ca49450f31d48cad23cf6317 100644 (file)
@@ -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;
 }
 
index 126ec7c8680ea176a156be4c4aca2cc16bcb66f5..58e128784585a41b9c80410eaf46500e40a337ba 100644 (file)
@@ -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);
index a4265bc1cebb7162fbbdcbc59ffd2590f292fc9e..88341bfb56349288d740858d1cf7cee2b6a77802 100644 (file)
@@ -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;
 
index c5095ecd8b116a5eea41ff799c27bf415c5bd597..0eff1a00c43c1de221a9e4208f2edbee3da03d8b 100644 (file)
@@ -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.
index 8c719b4df54401a0f95388d2285e918fe743e76f..949c6df74c97d18eeada6281d3d2e25f4449fa27 100644 (file)
@@ -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 */
index abac7db3819eac943df7497b86735482a63170ca..73d6ac9406b3d4b8f5523bd8010e1a8db95f914b 100644 (file)
@@ -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;
 
index 12dae8e24844a6ed0ee92ffb650cb731175ee5f6..cf27bf40d36eefe7285b67e9884bc87bbdee9af2 100644 (file)
@@ -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",
index 05df0a345b609744f243d1bbafcd05bbbe0e7d9f..73e2f278093220e4bd3f8f5094c9ab55a1d190f5 100644 (file)
@@ -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;
        }
 
index e3eca6d047c73322b6019f7f2c26f93ec2c48310..d8948bf8a27510ddbcb3b191c355ad10824503be 100644 (file)
@@ -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;
index c592641e914e695d99aa1e408acae2501ca03496..286b46c516ce18c112032a43c0c47e3f3bb6529a 100644 (file)
@@ -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;
index ba4fc2b3bf0a3a87f41ae6175b00c4593ef0fda4..d383c0f9fe3ebd61e1679000e1e8bea0623c0ff7 100644 (file)
@@ -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);