From 0b501fde5b1cf3c041551c8b358991ca939bea7b Mon Sep 17 00:00:00 2001
From: Frank Mori Hess <fmhess@speakeasy.net>
Date: Wed, 26 Sep 2001 00:07:01 +0000
Subject: [PATCH] fixed poll() code by unlocking spinlock on spurious interrupt

---
 comedi/drivers/das1800.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/comedi/drivers/das1800.c b/comedi/drivers/das1800.c
index 8affee9d..a3ac1e19 100644
--- a/comedi/drivers/das1800.c
+++ b/comedi/drivers/das1800.c
@@ -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;
 	}
 
-- 
2.26.2