fixed poll() code by unlocking spinlock on spurious interrupt
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 26 Sep 2001 00:07:01 +0000 (00:07 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 26 Sep 2001 00:07:01 +0000 (00:07 +0000)
comedi/drivers/das1800.c

index 8affee9d44aef7ea047421d8d842e8fcc496e893..a3ac1e192234eaaf9b05d608438d7ff4a4080f1a 100644 (file)
@@ -886,20 +886,22 @@ static void das1800_interrupt(int irq, void *d, struct pt_regs *regs)
        comedi_device *dev = d;
        int status;
 
-       /* Prevent race with das1800_ai_poll() on multi processor systems.
-        * Also protects indirect addressing in das1800_ai_handler */
-       spin_lock(&dev->spinlock);
-       status = inb(dev->iobase + DAS1800_STATUS);
-
        if(dev->attached == 0)
        {
                comedi_error(dev, "premature interrupt");
                return;
        }
+
+       /* Prevent race with das1800_ai_poll() on multi processor systems.
+        * Also protects indirect addressing in das1800_ai_handler */
+       spin_lock(&dev->spinlock);
+       status = inb(dev->iobase + DAS1800_STATUS);
+
        /* if interrupt was not caused by das-1800 */
        if(!(status & INT))
        {
                comedi_error(dev, "spurious interrupt");
+               spin_unlock(&dev->spinlock);
                return;
        }