aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/t128.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 00:11:56 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-20 03:11:07 -0500
commit22f5f10d2dadc50bf26a482b782a5e04f6e9b362 (patch)
tree0aa5f5690db24e368f6f3b2dded068889858e9f8 /drivers/scsi/t128.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/t128.c')
-rw-r--r--drivers/scsi/t128.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index 6220dee8b697..ad833689b311 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -228,15 +228,19 @@ found:
228 else 228 else
229 instance->irq = NCR5380_probe_irq(instance, T128_IRQS); 229 instance->irq = NCR5380_probe_irq(instance, T128_IRQS);
230 230
231 if (instance->irq != SCSI_IRQ_NONE) 231 /* Compatibility with documented NCR5380 kernel parameters */
232 if (instance->irq == 255)
233 instance->irq = NO_IRQ;
234
235 if (instance->irq != NO_IRQ)
232 if (request_irq(instance->irq, t128_intr, 0, "t128", 236 if (request_irq(instance->irq, t128_intr, 0, "t128",
233 instance)) { 237 instance)) {
234 printk("scsi%d : IRQ%d not free, interrupts disabled\n", 238 printk("scsi%d : IRQ%d not free, interrupts disabled\n",
235 instance->host_no, instance->irq); 239 instance->host_no, instance->irq);
236 instance->irq = SCSI_IRQ_NONE; 240 instance->irq = NO_IRQ;
237 } 241 }
238 242
239 if (instance->irq == SCSI_IRQ_NONE) { 243 if (instance->irq == NO_IRQ) {
240 printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no); 244 printk("scsi%d : interrupts not enabled. for better interactive performance,\n", instance->host_no);
241 printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no); 245 printk("scsi%d : please jumper the board for a free IRQ.\n", instance->host_no);
242 } 246 }
@@ -246,7 +250,7 @@ found:
246#endif 250#endif
247 251
248 printk("scsi%d : at 0x%08lx", instance->host_no, instance->base); 252 printk("scsi%d : at 0x%08lx", instance->host_no, instance->base);
249 if (instance->irq == SCSI_IRQ_NONE) 253 if (instance->irq == NO_IRQ)
250 printk (" interrupts disabled"); 254 printk (" interrupts disabled");
251 else 255 else
252 printk (" irq %d", instance->irq); 256 printk (" irq %d", instance->irq);
@@ -265,7 +269,7 @@ static int t128_release(struct Scsi_Host *shost)
265{ 269{
266 NCR5380_local_declare(); 270 NCR5380_local_declare();
267 NCR5380_setup(shost); 271 NCR5380_setup(shost);
268 if (shost->irq) 272 if (shost->irq != NO_IRQ)
269 free_irq(shost->irq, shost); 273 free_irq(shost->irq, shost);
270 NCR5380_exit(shost); 274 NCR5380_exit(shost);
271 if (shost->io_port && shost->n_io_port) 275 if (shost->io_port && shost->n_io_port)