diff options
author | Jeff Garzik <jeff@garzik.org> | 2008-04-24 19:45:32 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-27 13:19:55 -0400 |
commit | 87c4d7bc2aaa9b782aac6ab0a74cf16f87398bbc (patch) | |
tree | 2d588ba27d5e00e6a976de808cdda54716f63521 /drivers | |
parent | 9f9a73b6fe0c8fd9b54b650e34956eb92df6abfa (diff) |
[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: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/aha1542.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 5a1471c370fa..80594947c6f6 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -153,8 +153,6 @@ struct aha1542_hostdata { | |||
153 | 153 | ||
154 | #define HOSTDATA(host) ((struct aha1542_hostdata *) &host->hostdata) | 154 | #define HOSTDATA(host) ((struct aha1542_hostdata *) &host->hostdata) |
155 | 155 | ||
156 | static struct Scsi_Host *aha_host[7]; /* One for each IRQ level (9-15) */ | ||
157 | |||
158 | static DEFINE_SPINLOCK(aha1542_lock); | 156 | static DEFINE_SPINLOCK(aha1542_lock); |
159 | 157 | ||
160 | 158 | ||
@@ -163,8 +161,7 @@ static DEFINE_SPINLOCK(aha1542_lock); | |||
163 | 161 | ||
164 | static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt); | 162 | static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt); |
165 | static int aha1542_restart(struct Scsi_Host *shost); | 163 | static int aha1542_restart(struct Scsi_Host *shost); |
166 | static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id); | 164 | static void aha1542_intr_handle(struct Scsi_Host *shost); |
167 | static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id); | ||
168 | 165 | ||
169 | #define aha1542_intr_reset(base) outb(IRST, CONTROL(base)) | 166 | #define aha1542_intr_reset(base) outb(IRST, CONTROL(base)) |
170 | 167 | ||
@@ -404,23 +401,19 @@ fail: | |||
404 | } | 401 | } |
405 | 402 | ||
406 | /* A quick wrapper for do_aha1542_intr_handle to grab the spin lock */ | 403 | /* A quick wrapper for do_aha1542_intr_handle to grab the spin lock */ |
407 | static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id) | 404 | static irqreturn_t do_aha1542_intr_handle(int dummy, void *dev_id) |
408 | { | 405 | { |
409 | unsigned long flags; | 406 | unsigned long flags; |
410 | struct Scsi_Host *shost; | 407 | struct Scsi_Host *shost = dev_id; |
411 | |||
412 | shost = aha_host[irq - 9]; | ||
413 | if (!shost) | ||
414 | panic("Splunge!"); | ||
415 | 408 | ||
416 | spin_lock_irqsave(shost->host_lock, flags); | 409 | spin_lock_irqsave(shost->host_lock, flags); |
417 | aha1542_intr_handle(shost, dev_id); | 410 | aha1542_intr_handle(shost); |
418 | spin_unlock_irqrestore(shost->host_lock, flags); | 411 | spin_unlock_irqrestore(shost->host_lock, flags); |
419 | return IRQ_HANDLED; | 412 | return IRQ_HANDLED; |
420 | } | 413 | } |
421 | 414 | ||
422 | /* A "high" level interrupt handler */ | 415 | /* A "high" level interrupt handler */ |
423 | static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id) | 416 | static void aha1542_intr_handle(struct Scsi_Host *shost) |
424 | { | 417 | { |
425 | void (*my_done) (Scsi_Cmnd *) = NULL; | 418 | void (*my_done) (Scsi_Cmnd *) = NULL; |
426 | int errstatus, mbi, mbo, mbistatus; | 419 | int errstatus, mbi, mbo, mbistatus; |
@@ -1197,7 +1190,8 @@ fail: | |||
1197 | 1190 | ||
1198 | DEB(printk("aha1542_detect: enable interrupt channel %d\n", irq_level)); | 1191 | DEB(printk("aha1542_detect: enable interrupt channel %d\n", irq_level)); |
1199 | spin_lock_irqsave(&aha1542_lock, flags); | 1192 | spin_lock_irqsave(&aha1542_lock, flags); |
1200 | if (request_irq(irq_level, do_aha1542_intr_handle, 0, "aha1542", NULL)) { | 1193 | if (request_irq(irq_level, do_aha1542_intr_handle, 0, |
1194 | "aha1542", shpnt)) { | ||
1201 | printk(KERN_ERR "Unable to allocate IRQ for adaptec controller.\n"); | 1195 | printk(KERN_ERR "Unable to allocate IRQ for adaptec controller.\n"); |
1202 | spin_unlock_irqrestore(&aha1542_lock, flags); | 1196 | spin_unlock_irqrestore(&aha1542_lock, flags); |
1203 | goto unregister; | 1197 | goto unregister; |
@@ -1205,7 +1199,7 @@ fail: | |||
1205 | if (dma_chan != 0xFF) { | 1199 | if (dma_chan != 0xFF) { |
1206 | if (request_dma(dma_chan, "aha1542")) { | 1200 | if (request_dma(dma_chan, "aha1542")) { |
1207 | printk(KERN_ERR "Unable to allocate DMA channel for Adaptec.\n"); | 1201 | printk(KERN_ERR "Unable to allocate DMA channel for Adaptec.\n"); |
1208 | free_irq(irq_level, NULL); | 1202 | free_irq(irq_level, shpnt); |
1209 | spin_unlock_irqrestore(&aha1542_lock, flags); | 1203 | spin_unlock_irqrestore(&aha1542_lock, flags); |
1210 | goto unregister; | 1204 | goto unregister; |
1211 | } | 1205 | } |
@@ -1214,7 +1208,7 @@ fail: | |||
1214 | enable_dma(dma_chan); | 1208 | enable_dma(dma_chan); |
1215 | } | 1209 | } |
1216 | } | 1210 | } |
1217 | aha_host[irq_level - 9] = shpnt; | 1211 | |
1218 | shpnt->this_id = scsi_id; | 1212 | shpnt->this_id = scsi_id; |
1219 | shpnt->unique_id = base_io; | 1213 | shpnt->unique_id = base_io; |
1220 | shpnt->io_port = base_io; | 1214 | shpnt->io_port = base_io; |
@@ -1276,7 +1270,7 @@ unregister: | |||
1276 | static int aha1542_release(struct Scsi_Host *shost) | 1270 | static int aha1542_release(struct Scsi_Host *shost) |
1277 | { | 1271 | { |
1278 | if (shost->irq) | 1272 | if (shost->irq) |
1279 | free_irq(shost->irq, NULL); | 1273 | free_irq(shost->irq, shost); |
1280 | if (shost->dma_channel != 0xff) | 1274 | if (shost->dma_channel != 0xff) |
1281 | free_dma(shost->dma_channel); | 1275 | free_dma(shost->dma_channel); |
1282 | if (shost->io_port && shost->n_io_port) | 1276 | if (shost->io_port && shost->n_io_port) |