Commit 69e1a948 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Christoph Hellwig

[PATCH] fix up NCR5380 private data

Use the private data passed to request_irq instead of looping over all
controllers.  The patch was ACKed by Alan a while ago.

Note that the patch only looks so huge because of the two leves of
indentation removed by the tiny chage.
parent 26281b14
...@@ -1326,23 +1326,15 @@ static void NCR5380_main(void *p) ...@@ -1326,23 +1326,15 @@ static void NCR5380_main(void *p)
static irqreturn_t NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) static irqreturn_t NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs)
{ {
NCR5380_local_declare(); NCR5380_local_declare();
struct Scsi_Host *instance; struct Scsi_Host *instance = (struct Scsi_Host *)dev_id;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
int done; int done;
unsigned char basr; unsigned char basr;
struct NCR5380_hostdata *hostdata;
int handled = 0;
dprintk(NDEBUG_INTR, ("scsi : NCR5380 irq %d triggered\n", irq)); dprintk(NDEBUG_INTR, ("scsi : NCR5380 irq %d triggered\n", irq));
do { do {
done = 1; done = 1;
/* The instance list is constant while the driver is
loaded */
for (hostdata = first_host; hostdata != NULL; hostdata = hostdata->next)
{
instance = hostdata->host;
if (instance->irq == irq) {
handled = 1;
spin_lock_irq(instance->host_lock); spin_lock_irq(instance->host_lock);
/* Look for pending interrupts */ /* Look for pending interrupts */
NCR5380_setup(instance); NCR5380_setup(instance);
...@@ -1397,10 +1389,8 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1397,10 +1389,8 @@ static irqreturn_t NCR5380_intr(int irq, void *dev_id, struct pt_regs *regs)
spin_unlock_irq(instance->host_lock); spin_unlock_irq(instance->host_lock);
if(!done) if(!done)
schedule_work(&hostdata->coroutine); schedule_work(&hostdata->coroutine);
} /* if (instance->irq == irq) */
}
} while (!done); } while (!done);
return IRQ_RETVAL(handled); return IRQ_HANDLED;
} }
#endif #endif
......
...@@ -450,7 +450,7 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt) ...@@ -450,7 +450,7 @@ int __init generic_NCR5380_detect(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, SA_INTERRUPT, "NCR5380", NULL)) { if (request_irq(instance->irq, generic_NCR5380_intr, SA_INTERRUPT, "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;
} }
......
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