Commit 1e641664301744f0d381de43ae1e12343e60b479

Authored by Jeff Garzik
Committed by James Bottomley
1 parent 86e8dfc560

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

Showing 8 changed files with 23 additions and 19 deletions Side-by-side Diff

drivers/scsi/atari_scsi.c
... ... @@ -393,7 +393,7 @@
393 393  
394 394 #endif /* REAL_DMA */
395 395  
396   - NCR5380_intr(0, 0);
  396 + NCR5380_intr(irq, dummy);
397 397  
398 398 #if 0
399 399 /* To be sure the int is not masked */
... ... @@ -458,7 +458,7 @@
458 458  
459 459 #endif /* REAL_DMA */
460 460  
461   - NCR5380_intr(0, 0);
  461 + NCR5380_intr(irq, dummy);
462 462 return IRQ_HANDLED;
463 463 }
464 464  
... ... @@ -684,7 +684,7 @@
684 684 * interrupt after having cleared the pending flag for the DMA
685 685 * interrupt. */
686 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 688 printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI);
689 689 scsi_unregister(atari_scsi_host);
690 690 atari_stram_free(atari_dma_buffer);
... ... @@ -701,7 +701,7 @@
701 701 IRQ_TYPE_PRIO, "Hades DMA emulator",
702 702 hades_dma_emulator)) {
703 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 705 scsi_unregister(atari_scsi_host);
706 706 atari_stram_free(atari_dma_buffer);
707 707 atari_dma_buffer = 0;
... ... @@ -761,7 +761,7 @@
761 761 int atari_scsi_release(struct Scsi_Host *sh)
762 762 {
763 763 if (IS_A_TT())
764   - free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr);
  764 + free_irq(IRQ_TT_MFP_SCSI, sh);
765 765 if (atari_dma_buffer)
766 766 atari_stram_free(atari_dma_buffer);
767 767 return 1;
... ... @@ -277,7 +277,8 @@
277 277 /* With interrupts enabled, it will sometimes hang when doing heavy
278 278 * reads. So better not enable them until I finger it out. */
279 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 282 printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
282 283 instance->irq = SCSI_IRQ_NONE;
283 284 }
... ... @@ -459,7 +460,7 @@
459 460 NCR5380_local_declare();
460 461 NCR5380_setup(shost);
461 462 if (shost->irq)
462   - free_irq(shost->irq, NULL);
  463 + free_irq(shost->irq, shost);
463 464 NCR5380_exit(shost);
464 465 if (shost->io_port && shost->n_io_port)
465 466 release_region(shost->io_port, shost->n_io_port);
drivers/scsi/g_NCR5380.c
... ... @@ -460,7 +460,8 @@
460 460 instance->irq = NCR5380_probe_irq(instance, 0xffff);
461 461  
462 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 465 printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
465 466 instance->irq = SCSI_IRQ_NONE;
466 467 }
... ... @@ -513,7 +514,7 @@
513 514 NCR5380_setup(instance);
514 515  
515 516 if (instance->irq != SCSI_IRQ_NONE)
516   - free_irq(instance->irq, NULL);
  517 + free_irq(instance->irq, instance);
517 518 NCR5380_exit(instance);
518 519  
519 520 #ifndef CONFIG_SCSI_G_NCR5380_MEM
drivers/scsi/mac_scsi.c
... ... @@ -303,7 +303,7 @@
303 303  
304 304 if (instance->irq != SCSI_IRQ_NONE)
305 305 if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW,
306   - "ncr5380", instance)) {
  306 + "ncr5380", instance)) {
307 307 printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n",
308 308 instance->host_no, instance->irq);
309 309 instance->irq = SCSI_IRQ_NONE;
... ... @@ -326,7 +326,7 @@
326 326 int macscsi_release (struct Scsi_Host *shpnt)
327 327 {
328 328 if (shpnt->irq != SCSI_IRQ_NONE)
329   - free_irq (shpnt->irq, NCR5380_intr);
  329 + free_irq(shpnt->irq, shpnt);
330 330 NCR5380_exit(shpnt);
331 331  
332 332 return 0;
drivers/scsi/pas16.c
... ... @@ -453,7 +453,8 @@
453 453 instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
454 454  
455 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 458 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
458 459 instance->host_no, instance->irq);
459 460 instance->irq = SCSI_IRQ_NONE;
... ... @@ -604,7 +605,7 @@
604 605 static int pas16_release(struct Scsi_Host *shost)
605 606 {
606 607 if (shost->irq)
607   - free_irq(shost->irq, NULL);
  608 + free_irq(shost->irq, shost);
608 609 NCR5380_exit(shost);
609 610 if (shost->dma_channel != 0xff)
610 611 free_dma(shost->dma_channel);
drivers/scsi/sun3_scsi.c
... ... @@ -268,7 +268,7 @@
268 268 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
269 269  
270 270 if (request_irq(instance->irq, scsi_sun3_intr,
271   - 0, "Sun3SCSI-5380", NULL)) {
  271 + 0, "Sun3SCSI-5380", instance)) {
272 272 #ifndef REAL_DMA
273 273 printk("scsi%d: IRQ%d not free, interrupts disabled\n",
274 274 instance->host_no, instance->irq);
... ... @@ -310,7 +310,7 @@
310 310 int sun3scsi_release (struct Scsi_Host *shpnt)
311 311 {
312 312 if (shpnt->irq != SCSI_IRQ_NONE)
313   - free_irq (shpnt->irq, NULL);
  313 + free_irq(shpnt->irq, shpnt);
314 314  
315 315 iounmap((void *)sun3_scsi_regp);
316 316  
drivers/scsi/sun3_scsi_vme.c
... ... @@ -230,7 +230,7 @@
230 230 ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
231 231  
232 232 if (request_irq(instance->irq, scsi_sun3_intr,
233   - 0, "Sun3SCSI-5380VME", NULL)) {
  233 + 0, "Sun3SCSI-5380VME", instance)) {
234 234 #ifndef REAL_DMA
235 235 printk("scsi%d: IRQ%d not free, interrupts disabled\n",
236 236 instance->host_no, instance->irq);
... ... @@ -279,7 +279,7 @@
279 279 int sun3scsi_release (struct Scsi_Host *shpnt)
280 280 {
281 281 if (shpnt->irq != SCSI_IRQ_NONE)
282   - free_irq (shpnt->irq, NULL);
  282 + free_irq(shpnt->irq, shpnt);
283 283  
284 284 iounmap((void *)sun3_scsi_regp);
285 285  
... ... @@ -259,7 +259,8 @@
259 259 instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
260 260  
261 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 264 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
264 265 instance->host_no, instance->irq);
265 266 instance->irq = SCSI_IRQ_NONE;
... ... @@ -295,7 +296,7 @@
295 296 NCR5380_local_declare();
296 297 NCR5380_setup(shost);
297 298 if (shost->irq)
298   - free_irq(shost->irq, NULL);
  299 + free_irq(shost->irq, shost);
299 300 NCR5380_exit(shost);
300 301 if (shost->io_port && shost->n_io_port)
301 302 release_region(shost->io_port, shost->n_io_port);