Commit 1e641664 authored by Jeff Garzik's avatar Jeff Garzik Committed by James Bottomley

[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: default avatarJeff Garzik <jgarzik@redhat.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 86e8dfc5
...@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq, void *dummy) ...@@ -393,7 +393,7 @@ static irqreturn_t scsi_tt_intr(int irq, void *dummy)
#endif /* REAL_DMA */ #endif /* REAL_DMA */
NCR5380_intr(0, 0); NCR5380_intr(irq, dummy);
#if 0 #if 0
/* To be sure the int is not masked */ /* To be sure the int is not masked */
...@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dummy) ...@@ -458,7 +458,7 @@ static irqreturn_t scsi_falcon_intr(int irq, void *dummy)
#endif /* REAL_DMA */ #endif /* REAL_DMA */
NCR5380_intr(0, 0); NCR5380_intr(irq, dummy);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_template *host) ...@@ -684,7 +684,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
* interrupt after having cleared the pending flag for the DMA * interrupt after having cleared the pending flag for the DMA
* interrupt. */ * interrupt. */
if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW, if (request_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr, IRQ_TYPE_SLOW,
"SCSI NCR5380", scsi_tt_intr)) { "SCSI NCR5380", instance)) {
printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI); printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting",IRQ_TT_MFP_SCSI);
scsi_unregister(atari_scsi_host); scsi_unregister(atari_scsi_host);
atari_stram_free(atari_dma_buffer); atari_stram_free(atari_dma_buffer);
...@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_template *host) ...@@ -701,7 +701,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
IRQ_TYPE_PRIO, "Hades DMA emulator", IRQ_TYPE_PRIO, "Hades DMA emulator",
hades_dma_emulator)) { hades_dma_emulator)) {
printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2); printk(KERN_ERR "atari_scsi_detect: cannot allocate irq %d, aborting (MACH_IS_HADES)",IRQ_AUTO_2);
free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); free_irq(IRQ_TT_MFP_SCSI, instance);
scsi_unregister(atari_scsi_host); scsi_unregister(atari_scsi_host);
atari_stram_free(atari_dma_buffer); atari_stram_free(atari_dma_buffer);
atari_dma_buffer = 0; atari_dma_buffer = 0;
...@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_template *host) ...@@ -761,7 +761,7 @@ int atari_scsi_detect(struct scsi_host_template *host)
int atari_scsi_release(struct Scsi_Host *sh) int atari_scsi_release(struct Scsi_Host *sh)
{ {
if (IS_A_TT()) if (IS_A_TT())
free_irq(IRQ_TT_MFP_SCSI, scsi_tt_intr); free_irq(IRQ_TT_MFP_SCSI, sh);
if (atari_dma_buffer) if (atari_dma_buffer)
atari_stram_free(atari_dma_buffer); atari_stram_free(atari_dma_buffer);
return 1; return 1;
......
...@@ -277,7 +277,8 @@ static int __init dtc_detect(struct scsi_host_template * tpnt) ...@@ -277,7 +277,8 @@ static int __init dtc_detect(struct scsi_host_template * tpnt)
/* With interrupts enabled, it will sometimes hang when doing heavy /* With interrupts enabled, it will sometimes hang when doing heavy
* reads. So better not enable them until I finger it out. */ * reads. So better not enable them until I finger it out. */
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED, "dtc", instance)) { if (request_irq(instance->irq, dtc_intr, IRQF_DISABLED,
"dtc", instance)) {
printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
instance->irq = SCSI_IRQ_NONE; instance->irq = SCSI_IRQ_NONE;
} }
...@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host *shost) ...@@ -459,7 +460,7 @@ static int dtc_release(struct Scsi_Host *shost)
NCR5380_local_declare(); NCR5380_local_declare();
NCR5380_setup(shost); NCR5380_setup(shost);
if (shost->irq) if (shost->irq)
free_irq(shost->irq, NULL); free_irq(shost->irq, shost);
NCR5380_exit(shost); NCR5380_exit(shost);
if (shost->io_port && shost->n_io_port) if (shost->io_port && shost->n_io_port)
release_region(shost->io_port, shost->n_io_port); release_region(shost->io_port, shost->n_io_port);
......
...@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt) ...@@ -460,7 +460,8 @@ int __init generic_NCR5380_detect(struct scsi_host_template * tpnt)
instance->irq = NCR5380_probe_irq(instance, 0xffff); instance->irq = NCR5380_probe_irq(instance, 0xffff);
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
if (request_irq(instance->irq, generic_NCR5380_intr, IRQF_DISABLED, "NCR5380", instance)) { if (request_irq(instance->irq, generic_NCR5380_intr,
IRQF_DISABLED, "NCR5380", instance)) {
printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); printk(KERN_WARNING "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq);
instance->irq = SCSI_IRQ_NONE; instance->irq = SCSI_IRQ_NONE;
} }
...@@ -513,7 +514,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance) ...@@ -513,7 +514,7 @@ int generic_NCR5380_release_resources(struct Scsi_Host *instance)
NCR5380_setup(instance); NCR5380_setup(instance);
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
free_irq(instance->irq, NULL); free_irq(instance->irq, instance);
NCR5380_exit(instance); NCR5380_exit(instance);
#ifndef CONFIG_SCSI_G_NCR5380_MEM #ifndef CONFIG_SCSI_G_NCR5380_MEM
......
...@@ -303,7 +303,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) ...@@ -303,7 +303,7 @@ int macscsi_detect(struct scsi_host_template * tpnt)
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW, if (request_irq(instance->irq, NCR5380_intr, IRQ_FLG_SLOW,
"ncr5380", instance)) { "ncr5380", instance)) {
printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n", printk(KERN_WARNING "scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq); instance->host_no, instance->irq);
instance->irq = SCSI_IRQ_NONE; instance->irq = SCSI_IRQ_NONE;
...@@ -326,7 +326,7 @@ int macscsi_detect(struct scsi_host_template * tpnt) ...@@ -326,7 +326,7 @@ int macscsi_detect(struct scsi_host_template * tpnt)
int macscsi_release (struct Scsi_Host *shpnt) int macscsi_release (struct Scsi_Host *shpnt)
{ {
if (shpnt->irq != SCSI_IRQ_NONE) if (shpnt->irq != SCSI_IRQ_NONE)
free_irq (shpnt->irq, NCR5380_intr); free_irq(shpnt->irq, shpnt);
NCR5380_exit(shpnt); NCR5380_exit(shpnt);
return 0; return 0;
......
...@@ -453,7 +453,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt) ...@@ -453,7 +453,8 @@ int __init pas16_detect(struct scsi_host_template * tpnt)
instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS); instance->irq = NCR5380_probe_irq(instance, PAS16_IRQS);
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED, "pas16", instance)) { if (request_irq(instance->irq, pas16_intr, IRQF_DISABLED,
"pas16", instance)) {
printk("scsi%d : IRQ%d not free, interrupts disabled\n", printk("scsi%d : IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq); instance->host_no, instance->irq);
instance->irq = SCSI_IRQ_NONE; instance->irq = SCSI_IRQ_NONE;
...@@ -604,7 +605,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src ...@@ -604,7 +605,7 @@ static inline int NCR5380_pwrite (struct Scsi_Host *instance, unsigned char *src
static int pas16_release(struct Scsi_Host *shost) static int pas16_release(struct Scsi_Host *shost)
{ {
if (shost->irq) if (shost->irq)
free_irq(shost->irq, NULL); free_irq(shost->irq, shost);
NCR5380_exit(shost); NCR5380_exit(shost);
if (shost->dma_channel != 0xff) if (shost->dma_channel != 0xff)
free_dma(shost->dma_channel); free_dma(shost->dma_channel);
......
...@@ -268,7 +268,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) ...@@ -268,7 +268,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt)
((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
if (request_irq(instance->irq, scsi_sun3_intr, if (request_irq(instance->irq, scsi_sun3_intr,
0, "Sun3SCSI-5380", NULL)) { 0, "Sun3SCSI-5380", instance)) {
#ifndef REAL_DMA #ifndef REAL_DMA
printk("scsi%d: IRQ%d not free, interrupts disabled\n", printk("scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq); instance->host_no, instance->irq);
...@@ -310,7 +310,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt) ...@@ -310,7 +310,7 @@ int sun3scsi_detect(struct scsi_host_template * tpnt)
int sun3scsi_release (struct Scsi_Host *shpnt) int sun3scsi_release (struct Scsi_Host *shpnt)
{ {
if (shpnt->irq != SCSI_IRQ_NONE) if (shpnt->irq != SCSI_IRQ_NONE)
free_irq (shpnt->irq, NULL); free_irq(shpnt->irq, shpnt);
iounmap((void *)sun3_scsi_regp); iounmap((void *)sun3_scsi_regp);
......
...@@ -230,7 +230,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) ...@@ -230,7 +230,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt)
((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0; ((struct NCR5380_hostdata *)instance->hostdata)->ctrl = 0;
if (request_irq(instance->irq, scsi_sun3_intr, if (request_irq(instance->irq, scsi_sun3_intr,
0, "Sun3SCSI-5380VME", NULL)) { 0, "Sun3SCSI-5380VME", instance)) {
#ifndef REAL_DMA #ifndef REAL_DMA
printk("scsi%d: IRQ%d not free, interrupts disabled\n", printk("scsi%d: IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq); instance->host_no, instance->irq);
...@@ -279,7 +279,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt) ...@@ -279,7 +279,7 @@ static int sun3scsi_detect(struct scsi_host_template * tpnt)
int sun3scsi_release (struct Scsi_Host *shpnt) int sun3scsi_release (struct Scsi_Host *shpnt)
{ {
if (shpnt->irq != SCSI_IRQ_NONE) if (shpnt->irq != SCSI_IRQ_NONE)
free_irq (shpnt->irq, NULL); free_irq(shpnt->irq, shpnt);
iounmap((void *)sun3_scsi_regp); iounmap((void *)sun3_scsi_regp);
......
...@@ -259,7 +259,8 @@ int __init t128_detect(struct scsi_host_template * tpnt){ ...@@ -259,7 +259,8 @@ int __init t128_detect(struct scsi_host_template * tpnt){
instance->irq = NCR5380_probe_irq(instance, T128_IRQS); instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
if (instance->irq != SCSI_IRQ_NONE) if (instance->irq != SCSI_IRQ_NONE)
if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128", instance)) { if (request_irq(instance->irq, t128_intr, IRQF_DISABLED, "t128",
instance)) {
printk("scsi%d : IRQ%d not free, interrupts disabled\n", printk("scsi%d : IRQ%d not free, interrupts disabled\n",
instance->host_no, instance->irq); instance->host_no, instance->irq);
instance->irq = SCSI_IRQ_NONE; instance->irq = SCSI_IRQ_NONE;
...@@ -295,7 +296,7 @@ static int t128_release(struct Scsi_Host *shost) ...@@ -295,7 +296,7 @@ static int t128_release(struct Scsi_Host *shost)
NCR5380_local_declare(); NCR5380_local_declare();
NCR5380_setup(shost); NCR5380_setup(shost);
if (shost->irq) if (shost->irq)
free_irq(shost->irq, NULL); free_irq(shost->irq, shost);
NCR5380_exit(shost); NCR5380_exit(shost);
if (shost->io_port && shost->n_io_port) if (shost->io_port && shost->n_io_port)
release_region(shost->io_port, shost->n_io_port); release_region(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