[PATCH 06/15] [SCSI] minor irq handler cleanups

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeff Garzik
Date: Friday, April 18, 2008 - 4:22 pm

- remove pointless casts from void*

- remove needless references to 'irq' function argument, when that
  information is already stored somewhere in a driver-private struct.

- where the 'irq' function argument is known never to be used, rename
  it to 'dummy' to make this more obvious

- remove always-false tests for dev_id==NULL

- remove always-true tests for 'irq == host_struct->irq'

- replace per-irq lookup functions and tables with a direct reference
  to data object obtained via 'dev_id' function argument, passed from
  request_irq()

This change's main purpose is to prepare for the patchset in
jgarzik/misc-2.6.git#irq-remove, that explores removal of the
never-used 'irq' argument in each interrupt handler.

---
 drivers/scsi/aha152x.c |    7 +------
 drivers/scsi/eata.c    |   11 ++++-------
 drivers/scsi/u14-34f.c |    9 ++++-----
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 6ccdc96..a09b2d3 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1432,15 +1432,10 @@ static void run(struct work_struct *work)
  */
 static irqreturn_t intr(int irqno, void *dev_id)
 {
-	struct Scsi_Host *shpnt = (struct Scsi_Host *)dev_id;
+	struct Scsi_Host *shpnt = dev_id;
 	unsigned long flags;
 	unsigned char rev, dmacntrl0;
 
-	if (!shpnt) {
-		printk(KERN_ERR "aha152x: catched interrupt %d for unknown controller.\n", irqno);
-		return IRQ_NONE;
-	}
-
 	/*
 	 * Read a couple of registers that are known to not be all 1's. If
 	 * we read all 1's (-1), that means that either:
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 8be3d76..a73a6bb 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -2286,17 +2286,14 @@ static void flush_dev(struct scsi_device *dev, unsigned long cursec,
 	}
 }
 
-static irqreturn_t ihdlr(int irq, struct Scsi_Host *shost)
+static irqreturn_t ihdlr(struct Scsi_Host *shost)
 {
 	struct scsi_cmnd *SCpnt;
 	unsigned int i, k, c, status, tstatus, reg;
 	struct mssp *spp;
 	struct mscp *cpp;
 	struct hostdata *ha = (struct hostdata *)shost->hostdata;
-
-	if (shost->irq != irq)
-		panic("%s: ihdlr, irq %d, shost->irq %d.\n", ha->board_name, irq,
-		      shost->irq);
+	int irq = shost->irq;
 
 	/* Check if this board need to be serviced */
 	if (!(inb(shost->io_port + REG_AUX_STATUS) & IRQ_ASSERTED))
@@ -2535,7 +2532,7 @@ static irqreturn_t ihdlr(int irq, struct Scsi_Host *shost)
 	return IRQ_NONE;
 }
 
-static irqreturn_t do_interrupt_handler(int irq, void *shap)
+static irqreturn_t do_interrupt_handler(int dummy, void *shap)
 {
 	struct Scsi_Host *shost;
 	unsigned int j;
@@ -2548,7 +2545,7 @@ static irqreturn_t do_interrupt_handler(int irq, void *shap)
 	shost = sh[j];
 
 	spin_lock_irqsave(shost->host_lock, spin_flags);
-	ret = ihdlr(irq, shost);
+	ret = ihdlr(shost);
 	spin_unlock_irqrestore(shost->host_lock, spin_flags);
 	return ret;
 }
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 58d7eee..640333b 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1715,13 +1715,12 @@ static void flush_dev(struct scsi_device *dev, unsigned long cursec, unsigned in
 
 }
 
-static irqreturn_t ihdlr(int irq, unsigned int j) {
+static irqreturn_t ihdlr(unsigned int j)
+{
    struct scsi_cmnd *SCpnt;
    unsigned int i, k, c, status, tstatus, reg, ret;
    struct mscp *spp, *cpp;
-
-   if (sh[j]->irq != irq)
-       panic("%s: ihdlr, irq %d, sh[j]->irq %d.\n", BN(j), irq, sh[j]->irq);
+   int irq = sh[j]->irq;
 
    /* Check if this board need to be serviced */
    if (!((reg = inb(sh[j]->io_port + REG_SYS_INTR)) & IRQ_ASSERTED)) goto none;
@@ -1935,7 +1934,7 @@ static irqreturn_t do_interrupt_handler(int irq, void *shap) {
    if ((j = (unsigned int)((char *)shap - sha)) >= num_boards) return IRQ_NONE;
 
    spin_lock_irqsave(sh[j]->host_lock, spin_flags);
-   ret = ihdlr(irq, j);
+   ret = ihdlr(j);
    spin_unlock_irqrestore(sh[j]->host_lock, spin_flags);
    return ret;
 }
-- 
1.5.4.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 02/15] [SPARC] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 03/15] [BLACKFIN] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 04/15] [PPC] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 05/15] drivers/char: minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 06/15] [SCSI] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 08/15] [ISDN] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 10/15] [IA64] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:22 pm)
[PATCH 11/15] [RTC] minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 4:23 pm)
[PATCH 13/15] [X86] standard vm86 irq handler, Jeff Garzik, (Fri Apr 18, 4:23 pm)
[PATCH 14/15] Canonicalize several irq handlers., Jeff Garzik, (Fri Apr 18, 4:23 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Lennert Buytenhek, (Fri Apr 18, 4:29 pm)
Re: [PATCH 02/15] [SPARC] minor irq handler cleanups, David Miller, (Fri Apr 18, 4:33 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Andrew Morton, (Fri Apr 18, 4:44 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 5:21 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Fri Apr 18, 5:25 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Andrew Morton, (Fri Apr 18, 6:17 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Russell King, (Sat Apr 19, 1:17 am)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Sat Apr 19, 1:28 am)
Re: [PATCH 04/15] [PPC] minor irq handler cleanups, Kumar Gala, (Sat Apr 19, 7:57 am)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Lennert Buytenhek, (Sat Apr 19, 9:14 am)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Sun Apr 20, 3:17 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Russell King, (Sun Apr 20, 3:40 pm)
Re: [PATCH 01/15] ARM minor irq handler cleanups, Jeff Garzik, (Sun Apr 20, 3:49 pm)
Re: [PATCH 13/15] [X86] standard vm86 irq handler, Ingo Molnar, (Mon Apr 21, 6:52 am)
Re: [PATCH 05/15] drivers/char: minor irq handler cleanups, Benjamin Herrenschmidt, (Tue Apr 22, 1:05 am)
Re: [PATCH 05/15] drivers/char: minor irq handler cleanups, Benjamin Herrenschmidt, (Tue Apr 22, 3:46 am)