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>
This commit is contained in:
Finn Thain
2014-11-12 16:11:56 +11:00
committed by Christoph Hellwig
parent 3f9e986e2f
commit 22f5f10d2d
10 changed files with 66 additions and 48 deletions

View File

@@ -100,7 +100,7 @@ static int dmx3191d_probe_one(struct pci_dev *pdev,
*/
printk(KERN_WARNING "dmx3191: IRQ %d not available - "
"switching to polled mode.\n", pdev->irq);
shost->irq = SCSI_IRQ_NONE;
shost->irq = NO_IRQ;
}
pci_set_drvdata(pdev, shost);
@@ -113,7 +113,8 @@ static int dmx3191d_probe_one(struct pci_dev *pdev,
return 0;
out_free_irq:
free_irq(shost->irq, shost);
if (shost->irq != NO_IRQ)
free_irq(shost->irq, shost);
out_release_region:
release_region(io, DMX3191D_REGION_LEN);
out_disable_device:
@@ -130,7 +131,7 @@ static void dmx3191d_remove_one(struct pci_dev *pdev)
NCR5380_exit(shost);
if (shost->irq != SCSI_IRQ_NONE)
if (shost->irq != NO_IRQ)
free_irq(shost->irq, shost);
release_region(shost->io_port, DMX3191D_REGION_LEN);
pci_disable_device(pdev);