summaryrefslogtreecommitdiff
path: root/drivers/scsi/g_NCR5380.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 16:11:56 +1100
committerChristoph Hellwig <hch@lst.de>2014-11-20 09:11:07 +0100
commit22f5f10d2dadc50bf26a482b782a5e04f6e9b362 (patch)
tree0aa5f5690db24e368f6f3b2dded068889858e9f8 /drivers/scsi/g_NCR5380.c
parent3f9e986e2f1df8fa69ffe213098c1ee98f1c9584 (diff)
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/g_NCR5380.c')
-rw-r--r--drivers/scsi/g_NCR5380.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 151e1ad8fe9f..a2b70fb4c67f 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -312,7 +312,7 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
if (pnp_irq_valid(dev, 0))
overrides[count].irq = pnp_irq(dev, 0);
else
- overrides[count].irq = SCSI_IRQ_NONE;
+ overrides[count].irq = NO_IRQ;
if (pnp_dma_valid(dev, 0))
overrides[count].dma = pnp_dma(dev, 0);
else
@@ -432,20 +432,24 @@ static int __init generic_NCR5380_detect(struct scsi_host_template *tpnt)
else
instance->irq = NCR5380_probe_irq(instance, 0xffff);
- if (instance->irq != SCSI_IRQ_NONE)
+ /* Compatibility with documented NCR5380 kernel parameters */
+ if (instance->irq == 255)
+ instance->irq = NO_IRQ;
+
+ if (instance->irq != NO_IRQ)
if (request_irq(instance->irq, generic_NCR5380_intr,
0, "NCR5380", instance)) {
printk(KERN_WARNING "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_INFO "scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
printk(KERN_INFO "scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
}
printk(KERN_INFO "scsi%d : at " STRVAL(NCR5380_map_name) " 0x%x", instance->host_no, (unsigned int) instance->NCR5380_instance_name);
- if (instance->irq == SCSI_IRQ_NONE)
+ if (instance->irq == NO_IRQ)
printk(" interrupts disabled");
else
printk(" irq %d", instance->irq);
@@ -486,7 +490,7 @@ static int generic_NCR5380_release_resources(struct Scsi_Host *instance)
NCR5380_local_declare();
NCR5380_setup(instance);
- if (instance->irq != SCSI_IRQ_NONE)
+ if (instance->irq != NO_IRQ)
free_irq(instance->irq, instance);
NCR5380_exit(instance);
@@ -796,7 +800,7 @@ static int generic_NCR5380_show_info(struct seq_file *m, struct Scsi_Host *scsi_
PRINTP("NO NCR53C400 driver extensions\n");
#endif
PRINTP("Using %s mapping at %s 0x%lx, " ANDP STRVAL(NCR5380_map_config) ANDP STRVAL(NCR5380_map_name) ANDP scsi_ptr->NCR5380_instance_name);
- if (scsi_ptr->irq == SCSI_IRQ_NONE)
+ if (scsi_ptr->irq == NO_IRQ)
PRINTP("no interrupt\n");
else
PRINTP("on interrupt %d\n" ANDP scsi_ptr->irq);