Commit 87c4d7bc authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley

[SCSI] aha1542: minor irq handler cleanups

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

- replace per-irq lookup functions and tables with a direct reference
  to data object obtained via 'dev_id' function argument, passed from
  request_irq()
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 9f9a73b6
...@@ -153,8 +153,6 @@ struct aha1542_hostdata { ...@@ -153,8 +153,6 @@ struct aha1542_hostdata {
#define HOSTDATA(host) ((struct aha1542_hostdata *) &host->hostdata) #define HOSTDATA(host) ((struct aha1542_hostdata *) &host->hostdata)
static struct Scsi_Host *aha_host[7]; /* One for each IRQ level (9-15) */
static DEFINE_SPINLOCK(aha1542_lock); static DEFINE_SPINLOCK(aha1542_lock);
...@@ -163,8 +161,7 @@ static DEFINE_SPINLOCK(aha1542_lock); ...@@ -163,8 +161,7 @@ static DEFINE_SPINLOCK(aha1542_lock);
static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt); static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt);
static int aha1542_restart(struct Scsi_Host *shost); static int aha1542_restart(struct Scsi_Host *shost);
static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id); static void aha1542_intr_handle(struct Scsi_Host *shost);
static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id);
#define aha1542_intr_reset(base) outb(IRST, CONTROL(base)) #define aha1542_intr_reset(base) outb(IRST, CONTROL(base))
...@@ -404,23 +401,19 @@ static int __init aha1542_test_port(int bse, struct Scsi_Host *shpnt) ...@@ -404,23 +401,19 @@ static int __init aha1542_test_port(int bse, struct Scsi_Host *shpnt)
} }
/* A quick wrapper for do_aha1542_intr_handle to grab the spin lock */ /* A quick wrapper for do_aha1542_intr_handle to grab the spin lock */
static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id) static irqreturn_t do_aha1542_intr_handle(int dummy, void *dev_id)
{ {
unsigned long flags; unsigned long flags;
struct Scsi_Host *shost; struct Scsi_Host *shost = dev_id;
shost = aha_host[irq - 9];
if (!shost)
panic("Splunge!");
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
aha1542_intr_handle(shost, dev_id); aha1542_intr_handle(shost);
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
/* A "high" level interrupt handler */ /* A "high" level interrupt handler */
static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id) static void aha1542_intr_handle(struct Scsi_Host *shost)
{ {
void (*my_done) (Scsi_Cmnd *) = NULL; void (*my_done) (Scsi_Cmnd *) = NULL;
int errstatus, mbi, mbo, mbistatus; int errstatus, mbi, mbo, mbistatus;
...@@ -1197,7 +1190,8 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) ...@@ -1197,7 +1190,8 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
DEB(printk("aha1542_detect: enable interrupt channel %d\n", irq_level)); DEB(printk("aha1542_detect: enable interrupt channel %d\n", irq_level));
spin_lock_irqsave(&aha1542_lock, flags); spin_lock_irqsave(&aha1542_lock, flags);
if (request_irq(irq_level, do_aha1542_intr_handle, 0, "aha1542", NULL)) { if (request_irq(irq_level, do_aha1542_intr_handle, 0,
"aha1542", shpnt)) {
printk(KERN_ERR "Unable to allocate IRQ for adaptec controller.\n"); printk(KERN_ERR "Unable to allocate IRQ for adaptec controller.\n");
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
goto unregister; goto unregister;
...@@ -1205,7 +1199,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) ...@@ -1205,7 +1199,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
if (dma_chan != 0xFF) { if (dma_chan != 0xFF) {
if (request_dma(dma_chan, "aha1542")) { if (request_dma(dma_chan, "aha1542")) {
printk(KERN_ERR "Unable to allocate DMA channel for Adaptec.\n"); printk(KERN_ERR "Unable to allocate DMA channel for Adaptec.\n");
free_irq(irq_level, NULL); free_irq(irq_level, shpnt);
spin_unlock_irqrestore(&aha1542_lock, flags); spin_unlock_irqrestore(&aha1542_lock, flags);
goto unregister; goto unregister;
} }
...@@ -1214,7 +1208,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) ...@@ -1214,7 +1208,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
enable_dma(dma_chan); enable_dma(dma_chan);
} }
} }
aha_host[irq_level - 9] = shpnt;
shpnt->this_id = scsi_id; shpnt->this_id = scsi_id;
shpnt->unique_id = base_io; shpnt->unique_id = base_io;
shpnt->io_port = base_io; shpnt->io_port = base_io;
...@@ -1276,7 +1270,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt) ...@@ -1276,7 +1270,7 @@ static int __init aha1542_detect(struct scsi_host_template * tpnt)
static int aha1542_release(struct Scsi_Host *shost) static int aha1542_release(struct Scsi_Host *shost)
{ {
if (shost->irq) if (shost->irq)
free_irq(shost->irq, NULL); free_irq(shost->irq, shost);
if (shost->dma_channel != 0xff) if (shost->dma_channel != 0xff)
free_dma(shost->dma_channel); free_dma(shost->dma_channel);
if (shost->io_port && shost->n_io_port) if (shost->io_port && shost->n_io_port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment