diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-11-11 19:52:05 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2007-11-25 05:19:26 -0500 |
commit | 1e641664301744f0d381de43ae1e12343e60b479 (patch) | |
tree | 974c977e1dd9787c943d16b771372f08b48f346d | |
parent | 86e8dfc5603ed76917eed0a9dd9e85a1e1a8b162 (diff) |
[SCSI] NCR5380: Fix bugs and canonicalize irq handler usage
* Always pass the same value to free_irq() that we pass to
request_irq(). This fixes several bugs.
* Always call NCR5380_intr() with 'irq' and 'dev_id' arguments.
Note, scsi_falcon_intr() is the only case now where dev_id is not the
scsi_host.
* Always pass Scsi_Host to request_irq(). For most cases, the drivers
already did so, and I merely neated the source code line. In other
cases, either NULL or a non-sensical value was passed, verified to be
unused, then changed to be Scsi_Host in anticipation of the future.
In addition to the bugs fixes, this change makes the interface usage
consistent, which in turn enables the possibility of directly
referencing Scsi_Host from all NCR5380_intr() invocations.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r-- | drivers/scsi/atari_scsi.c | 10 | ||||
-rw-r--r-- | drivers/scsi/dtc.c | 5 | ||||
-rw-r--r-- | drivers/scsi/g_NCR5380.c | 5 | ||||
-rw-r--r-- | drivers/scsi/mac_scsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/pas16.c | 5 | ||||
-rw-r--r-- | drivers/scsi/sun3_scsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sun3_scsi_vme.c | 4 | ||||
-rw-r--r-- | drivers/scsi/t128.c | 5 |
8 files changed, 23 insertions, 19 deletions
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index 6f8403b82ba1..f5732d8f67fe 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq, void *dummy) | |||
393 | 393 | ||
394 | #endif /* REAL_DMA */ | 394 | #endif /* REAL_DMA */ |
395 | 395 | ||
396 | NCR5380_intr(0, 0); | 396 | NCR5380_intr(irq, dummy); |
397 | 397 | ||
398 | #if 0 | 398 | #if 0 |
399 | /* To be sure the int is not masked */ | 399 | /* To be sure the int is not masked */ |
@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dummy) | |||
458 | 458 | ||
459 | #endif /* REAL_DMA */ | 459 | #endif /* REAL_DMA */ |
460 | 460 | ||
461 | NCR5380_intr(0, 0); | 461 | NCR5380_intr(irq, dummy); |
462 | return IRQ_HANDLED; | 462 | return IRQ_HANDLED; |
463 | } | 463 | } |
464 | 464 | ||
@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
684 | * interrupt after having cleared the pending flag for the DMA | 684 | * interrupt after having cleared the pending flag for the DMA |
685 | * interrupt. */ | 685 | * interrupt. */ |
686 | if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, | 686 | if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, |
687 | "SCSI NCR5380", scsi_tt_intr)) { | 687 | "SCSI NCR5380", instance)) { |
688 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); | 688 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); |
689 | scsi_unregister(atari_scsi_host); | 689 | scsi_unregister(atari_scsi_host); |
690 | atari_stram_free(atari_dma_buffer); | 690 | atari_stram_free(atari_dma_buffer); |
@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
701 | IRQ_TYPE_PRIO, "Hades DMA emulator", | 701 | IRQ_TYPE_PRIO, "Hades DMA emulator", |
702 | hades_dma_emulator)) { | 702 | hades_dma_emulator)) { |
703 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); | 703 | printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); |
704 | free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); | 704 | free_irq(IRQ_TT_MFP_SCSI, instance); |
705 | scsi_unregister(atari_scsi_host); | 705 | scsi_unregister(atari_scsi_host); |
706 | atari_stram_free(atari_dma_buffer); | 706 | atari_stram_free(atari_dma_buffer); |
707 | atari_dma_buffer = 0; | 707 | atari_dma_buffer = 0; |
@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_template *host) | |||
761 | int atari_scsi_release(struct Scsi_Host *sh) | 761 | int atari_scsi_release(struct Scsi_Host *sh) |
762 | { | 762 | { |
763 | if (IS_A_TT()) | 763 | if (IS_A_TT()) |
764 | free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); | 764 | free_irq(IRQ_TT_MFP_SCSI, sh); |
765 | if (atari_dma_buffer) | 765 | if (atari_dma_buffer) |
766 | atari_stram_free(atari_dma_buffer); | 766 | atari_stram_free(atari_dma_buffer); |
767 | return 1; | 767 | return 1; |
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 2596165096d3..c2677ba29c74 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c | |||
@@ -277,7 +277,8 @@ found: | |||
277 | /* With interrupts enabled, it will sometimes hang when doing heavy | 277 | /* With interrupts enabled, it will sometimes hang when doing heavy |
278 | * reads. So better not enable them until I finger it out. */ | 278 | * reads. So better not enable them until I finger it out. */ |
279 | if (instance->irq != SCSI_IRQ_NONE) | 279 | if (instance->irq != SCSI_IRQ_NONE) |
280 | if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { | 280 | if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, |
281 | "dtc", instance)) { | ||
281 | printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); | 282 | printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); |
282 | instance->irq = SCSI_IRQ_NONE; | 283 | instance->irq = SCSI_IRQ_NONE; |
283 | } | 284 | } |
@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host *shost) | |||
459 | NCR5380_local_declare(); | 460 | NCR5380_local_declare(); |
460 | NCR5380_setup(shost); | 461 | NCR5380_setup(shost); |
461 | if (shost->irq) | 462 | if (shost->irq) |
462 | free_irq(shost->irq, NULL); | 463 | free_irq(shost->irq, shost); |
463 | NCR5380_exit(shost); | 464 | NCR5380_exit(shost); |
464 | if (shost->io_port && shost->n_io_port) | 465 | if (shost->io_port && shost->n_io_port) |
465 | release_region(shost->io_port, shost->n_io_port); | 466 | release_region(shost->io_port, shost->n_io_port); |
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c index 607336f56d55..75585a52c88b 100644 --- a/drivers/scsi/g_NCR5380.c +++ b/drivers/scsi/g_NCR5380.c | |||
@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) | |||
460 | instance->irq = NCR5380_probe_irq(instance, 0xffff); | 460 | instance->irq = NCR5380_probe_irq(instance, 0xffff); |
461 | 461 | ||
462 | if (instance->irq != SCSI_IRQ_NONE) | 462 | if (instance->irq != SCSI_IRQ_NONE) |
463 | if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { | 463 | if (request_irq(instance->irq, generic_NCR5380_intr, |
464 | IRQF_DISABLED, "NCR5380", instance)) { | ||
464 | printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); | 465 | printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); |
465 | instance->irq = SCSI_IRQ_NONE; | 466 | instance->irq = SCSI_IRQ_NONE; |
466 | } | 467 | } |
@@ -513,7 +514,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance) | |||
513 | NCR5380_setup(instance); | 514 | NCR5380_setup(instance); |
514 | 515 | ||
515 | if (instance->irq != SCSI_IRQ_NONE) | 516 | if (instance->irq != SCSI_IRQ_NONE) |
516 | free_irq(instance->irq, NULL); | 517 | free_irq(instance->irq, instance); |
517 | NCR5380_exit(instance); | 518 | NCR5380_exit(instance); |
518 | 519 | ||
519 | #ifndef CONFIG_SCSI_G_NCR5380_MEM | 520 | #ifndef CONFIG_SCSI_G_NCR5380_MEM |
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index abe2bda6ac37..3b09ab21d701 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c | |||
@@ -303,7 +303,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) | |||
303 | 303 | ||
304 | if (instance->irq != SCSI_IRQ_NONE) | 304 | if (instance->irq != SCSI_IRQ_NONE) |
305 | if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, | 305 | if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, |
306 | "ncr5380", instance)) { | 306 | "ncr5380", instance)) { |
307 | printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", | 307 | printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", |
308 | instance->host_no, instance->irq); | 308 | instance->host_no, instance->irq); |
309 | instance->irq = SCSI_IRQ_NONE; | 309 | instance->irq = SCSI_IRQ_NONE; |
@@ -326,7 +326,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) | |||
326 | int macscsi_release (struct Scsi_Host *shpnt) | 326 | int macscsi_release (struct Scsi_Host *shpnt) |
327 | { | 327 | { |
328 | if (shpnt->irq != SCSI_IRQ_NONE) | 328 | if (shpnt->irq != SCSI_IRQ_NONE) |
329 | free_irq (shpnt->irq, NCR5380_intr); | 329 | free_irq(shpnt->irq, shpnt); |
330 | NCR5380_exit(shpnt); | 330 | NCR5380_exit(shpnt); |
331 | 331 | ||
332 | return 0; | 332 | return 0; |
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c index ee5965659971..f2018b46f494 100644 --- a/drivers/scsi/pas16.c +++ b/drivers/scsi/pas16.c | |||
@@ -453,7 +453,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt) | |||
453 | instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); | 453 | instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); |
454 | 454 | ||
455 | if (instance->irq != SCSI_IRQ_NONE) | 455 | if (instance->irq != SCSI_IRQ_NONE) |
456 | if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { | 456 | if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, |
457 | "pas16", instance)) { | ||
457 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", | 458 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", |
458 | instance->host_no, instance->irq); | 459 | instance->host_no, instance->irq); |
459 | instance->irq = SCSI_IRQ_NONE; | 460 | instance->irq = SCSI_IRQ_NONE; |
@@ -604,7 +605,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src | |||
604 | static int pas16_release(struct Scsi_Host *shost) | 605 | static int pas16_release(struct Scsi_Host *shost) |
605 | { | 606 | { |
606 | if (shost->irq) | 607 | if (shost->irq) |
607 | free_irq(shost->irq, NULL); | 608 | free_irq(shost->irq, shost); |
608 | NCR5380_exit(shost); | 609 | NCR5380_exit(shost); |
609 | if (shost->dma_channel != 0xff) | 610 | if (shost->dma_channel != 0xff) |
610 | free_dma(shost->dma_channel); | 611 | free_dma(shost->dma_channel); |
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c index 5e46d842c6f9..e606cf0a2eb7 100644 --- a/drivers/scsi/sun3_scsi.c +++ b/drivers/scsi/sun3_scsi.c | |||
@@ -268,7 +268,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
268 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; | 268 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; |
269 | 269 | ||
270 | if (request_irq(instance->irq, scsi_sun3_intr, | 270 | if (request_irq(instance->irq, scsi_sun3_intr, |
271 | 0, "Sun3SCSI-5380", NULL)) { | 271 | 0, "Sun3SCSI-5380", instance)) { |
272 | #ifndef REAL_DMA | 272 | #ifndef REAL_DMA |
273 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", | 273 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", |
274 | instance->host_no, instance->irq); | 274 | instance->host_no, instance->irq); |
@@ -310,7 +310,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
310 | int sun3scsi_release (struct Scsi_Host *shpnt) | 310 | int sun3scsi_release (struct Scsi_Host *shpnt) |
311 | { | 311 | { |
312 | if (shpnt->irq != SCSI_IRQ_NONE) | 312 | if (shpnt->irq != SCSI_IRQ_NONE) |
313 | free_irq (shpnt->irq, NULL); | 313 | free_irq(shpnt->irq, shpnt); |
314 | 314 | ||
315 | iounmap((void *)sun3_scsi_regp); | 315 | iounmap((void *)sun3_scsi_regp); |
316 | 316 | ||
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c index 7cb4a31453e6..02d9727f017a 100644 --- a/drivers/scsi/sun3_scsi_vme.c +++ b/drivers/scsi/sun3_scsi_vme.c | |||
@@ -230,7 +230,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
230 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; | 230 | ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; |
231 | 231 | ||
232 | if (request_irq(instance->irq, scsi_sun3_intr, | 232 | if (request_irq(instance->irq, scsi_sun3_intr, |
233 | 0, "Sun3SCSI-5380VME", NULL)) { | 233 | 0, "Sun3SCSI-5380VME", instance)) { |
234 | #ifndef REAL_DMA | 234 | #ifndef REAL_DMA |
235 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", | 235 | printk("scsi%d: IRQ%d not free, interrupts disabled\n", |
236 | instance->host_no, instance->irq); | 236 | instance->host_no, instance->irq); |
@@ -279,7 +279,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) | |||
279 | int sun3scsi_release (struct Scsi_Host *shpnt) | 279 | int sun3scsi_release (struct Scsi_Host *shpnt) |
280 | { | 280 | { |
281 | if (shpnt->irq != SCSI_IRQ_NONE) | 281 | if (shpnt->irq != SCSI_IRQ_NONE) |
282 | free_irq (shpnt->irq, NULL); | 282 | free_irq(shpnt->irq, shpnt); |
283 | 283 | ||
284 | iounmap((void *)sun3_scsi_regp); | 284 | iounmap((void *)sun3_scsi_regp); |
285 | 285 | ||
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c index 248d60b8d899..041eaaace2c3 100644 --- a/drivers/scsi/t128.c +++ b/drivers/scsi/t128.c | |||
@@ -259,7 +259,8 @@ found: | |||
259 | instance->irq = NCR5380_probe_irq(instance, T128_IRQS); | 259 | instance->irq = NCR5380_probe_irq(instance, T128_IRQS); |
260 | 260 | ||
261 | if (instance->irq != SCSI_IRQ_NONE) | 261 | if (instance->irq != SCSI_IRQ_NONE) |
262 | if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { | 262 | if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", |
263 | instance)) { | ||
263 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", | 264 | printk("scsi%d : IRQ%d not free, interrupts disabled\n", |
264 | instance->host_no, instance->irq); | 265 | instance->host_no, instance->irq); |
265 | instance->irq = SCSI_IRQ_NONE; | 266 | instance->irq = SCSI_IRQ_NONE; |
@@ -295,7 +296,7 @@ static int t128_release(struct Scsi_Host *shost) | |||
295 | NCR5380_local_declare(); | 296 | NCR5380_local_declare(); |
296 | NCR5380_setup(shost); | 297 | NCR5380_setup(shost); |
297 | if (shost->irq) | 298 | if (shost->irq) |
298 | free_irq(shost->irq, NULL); | 299 | free_irq(shost->irq, shost); |
299 | NCR5380_exit(shost); | 300 | NCR5380_exit(shost); |
300 | if (shost->io_port && shost->n_io_port) | 301 | if (shost->io_port && shost->n_io_port) |
301 | release_region(shost->io_port, shost->n_io_port); | 302 | release_region(shost->io_port, shost->n_io_port); |