Commit 87c4d7bc2aaa9b782aac6ab0a74cf16f87398bbc

Authored by Jeff Garzik
Committed by James Bottomley
1 parent 9f9a73b6fe

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

Showing 1 changed file with 10 additions and 16 deletions Side-by-side Diff

drivers/scsi/aha1542.c
... ... @@ -153,8 +153,6 @@
153 153  
154 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 156 static DEFINE_SPINLOCK(aha1542_lock);
159 157  
160 158  
... ... @@ -163,8 +161,7 @@
163 161  
164 162 static void setup_mailboxes(int base_io, struct Scsi_Host *shpnt);
165 163 static int aha1542_restart(struct Scsi_Host *shost);
166   -static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id);
167   -static irqreturn_t do_aha1542_intr_handle(int irq, void *dev_id);
  164 +static void aha1542_intr_handle(struct Scsi_Host *shost);
168 165  
169 166 #define aha1542_intr_reset(base) outb(IRST, CONTROL(base))
170 167  
171 168  
172 169  
173 170  
174 171  
... ... @@ -404,23 +401,19 @@
404 401 }
405 402  
406 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 406 unsigned long flags;
410   - struct Scsi_Host *shost;
  407 + struct Scsi_Host *shost = dev_id;
411 408  
412   - shost = aha_host[irq - 9];
413   - if (!shost)
414   - panic("Splunge!");
415   -
416 409 spin_lock_irqsave(shost->host_lock, flags);
417   - aha1542_intr_handle(shost, dev_id);
  410 + aha1542_intr_handle(shost);
418 411 spin_unlock_irqrestore(shost->host_lock, flags);
419 412 return IRQ_HANDLED;
420 413 }
421 414  
422 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 418 void (*my_done) (Scsi_Cmnd *) = NULL;
426 419 int errstatus, mbi, mbo, mbistatus;
... ... @@ -1197,7 +1190,8 @@
1197 1190  
1198 1191 DEB(printk("aha1542_detect: enable interrupt channel %d\n", irq_level));
1199 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 1195 printk(KERN_ERR "Unable to allocate IRQ for adaptec controller.\n");
1202 1196 spin_unlock_irqrestore(&aha1542_lock, flags);
1203 1197 goto unregister;
... ... @@ -1205,7 +1199,7 @@
1205 1199 if (dma_chan != 0xFF) {
1206 1200 if (request_dma(dma_chan, "aha1542")) {
1207 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 1203 spin_unlock_irqrestore(&aha1542_lock, flags);
1210 1204 goto unregister;
1211 1205 }
... ... @@ -1214,7 +1208,7 @@
1214 1208 enable_dma(dma_chan);
1215 1209 }
1216 1210 }
1217   - aha_host[irq_level - 9] = shpnt;
  1211 +
1218 1212 shpnt->this_id = scsi_id;
1219 1213 shpnt->unique_id = base_io;
1220 1214 shpnt->io_port = base_io;
... ... @@ -1276,7 +1270,7 @@
1276 1270 static int aha1542_release(struct Scsi_Host *shost)
1277 1271 {
1278 1272 if (shost->irq)
1279   - free_irq(shost->irq, NULL);
  1273 + free_irq(shost->irq, shost);
1280 1274 if (shost->dma_channel != 0xff)
1281 1275 free_dma(shost->dma_channel);
1282 1276 if (shost->io_port && shost->n_io_port)