diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2014-11-12 08:11:56 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-20 11:11:07 +0300 |
commit | 22f5f10d2dadc50bf26a482b782a5e04f6e9b362 (patch) | |
tree | 0aa5f5690db24e368f6f3b2dded068889858e9f8 /drivers/scsi/dtc.c | |
parent | 3f9e986e2f1df8fa69ffe213098c1ee98f1c9584 (diff) | |
download | linux-22f5f10d2dadc50bf26a482b782a5e04f6e9b362.tar.xz |
ncr5380: Fix SCSI_IRQ_NONE bugs
Oak scsi doesn't use any IRQ, but it sets irq = IRQ_NONE rather than
SCSI_IRQ_NONE. Problem is, the core NCR5380 driver expects SCSI_IRQ_NONE
if it is to issue IDENTIFY commands that prevent target disconnection.
And, as Geert points out, IRQ_NONE is part of enum irqreturn.
Other drivers, when they can't get an IRQ or can't use one, will set
host->irq = SCSI_IRQ_NONE (that is, 255). But when they exit they will
attempt to free IRQ 255 which was never requested.
Fix these bugs by using NO_IRQ in place of SCSI_IRQ_NONE and IRQ_NONE.
That means IRQ 0 is no longer probed by ISA drivers but I don't think
this matters.
Setting IRQ = 255 for these ISA drivers is understood to mean no IRQ.
This remains supported so as to avoid breaking existing ISA setups (which
can be difficult to get working) and because existing documentation
(SANE, TLDP etc) describes this usage for the ISA NCR5380 driver options.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/dtc.c')
-rw-r--r-- | drivers/scsi/dtc.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c index 43be785778d9..2971c7f0e898 100644 --- a/drivers/scsi/dtc.c +++ b/drivers/scsi/dtc.c @@ -254,31 +254,35 @@ found: else instance->irq = NCR5380_probe_irq(instance, DTC_IRQS); + /* Compatibility with documented NCR5380 kernel parameters */ + if (instance->irq == 255) + instance->irq = NO_IRQ; + #ifndef DONT_USE_INTR /* With interrupts enabled, it will sometimes hang when doing heavy * reads. So better not enable them until I finger it out. */ - if (instance->irq != SCSI_IRQ_NONE) + if (instance->irq != NO_IRQ) if (request_irq(instance->irq, dtc_intr, 0, "dtc", instance)) { printk(KERN_ERR "scsi%d : IRQ%d not free, interrupts disabled\n", instance->host_no, instance->irq); - instance->irq = SCSI_IRQ_NONE; + instance->irq = NO_IRQ; } - if (instance->irq == SCSI_IRQ_NONE) { + if (instance->irq == NO_IRQ) { printk(KERN_WARNING "scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no); printk(KERN_WARNING "scsi%d : please jumper the board for a free IRQ.\n", instance->host_no); } #else - if (instance->irq != SCSI_IRQ_NONE) + if (instance->irq != NO_IRQ) printk(KERN_WARNING "scsi%d : interrupts not used. Might as well not jumper it.\n", instance->host_no); - instance->irq = SCSI_IRQ_NONE; + instance->irq = NO_IRQ; #endif #if defined(DTCDEBUG) && (DTCDEBUG & DTCDEBUG_INIT) printk("scsi%d : irq = %d\n", instance->host_no, instance->irq); #endif printk(KERN_INFO "scsi%d : at 0x%05X", instance->host_no, (int) instance->base); - if (instance->irq == SCSI_IRQ_NONE) + if (instance->irq == NO_IRQ) printk(" interrupts disabled"); else printk(" irq %d", instance->irq); @@ -350,7 +354,7 @@ static inline int NCR5380_pread(struct Scsi_Host *instance, unsigned char *dst, i = 0; NCR5380_read(RESET_PARITY_INTERRUPT_REG); NCR5380_write(MODE_REG, MR_ENABLE_EOP_INTR | MR_DMA_MODE); - if (instance->irq == SCSI_IRQ_NONE) + if (instance->irq == NO_IRQ) NCR5380_write(DTC_CONTROL_REG, CSR_DIR_READ); else NCR5380_write(DTC_CONTROL_REG, CSR_DIR_READ | CSR_INT_BASE); @@ -401,7 +405,7 @@ static inline int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, NCR5380_read(RESET_PARITY_INTERRUPT_REG); NCR5380_write(MODE_REG, MR_ENABLE_EOP_INTR | MR_DMA_MODE); /* set direction (write) */ - if (instance->irq == SCSI_IRQ_NONE) + if (instance->irq == NO_IRQ) NCR5380_write(DTC_CONTROL_REG, 0); else NCR5380_write(DTC_CONTROL_REG, CSR_5380_INTR); @@ -440,7 +444,7 @@ static int dtc_release(struct Scsi_Host *shost) { NCR5380_local_declare(); NCR5380_setup(shost); - if (shost->irq) + if (shost->irq != NO_IRQ) free_irq(shost->irq, shost); NCR5380_exit(shost); if (shost->io_port && shost->n_io_port) |