[PATCH 28/67 v2] staging: comedi: pcl818: exit interrupt quick when there is nothing to do

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If an async ai command is not running or the ai_mode is 0 the interrupt
routine doesn't do anything other than spew some noise and clear the
interrupt request in the hardware.

Because this driver is manually attached, the "premature interrupt"
check in the interrupt handler should never happen. The interrupt is
only hooked up during the attach and it's released during the detach.

Combine these checks so that the interrupt function exits quick if it
has nothing to handle. Remove the noise.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcl818.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index 6c91a7b..d00d690 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -732,8 +732,9 @@ static irqreturn_t interrupt_pcl818(int irq, void *d)
 	struct pcl818_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
 
-	if (!dev->attached) {
-		comedi_error(dev, "premature interrupt");
+	if (!dev->attached || !devpriv->ai_cmd_running ||
+	    !devpriv->ai_mode) {
+		outb(0, dev->iobase + PCL818_CLRINT);
 		return IRQ_HANDLED;
 	}
 
@@ -764,15 +765,8 @@ static irqreturn_t interrupt_pcl818(int irq, void *d)
 		break;
 	}
 
-	outb(0, dev->iobase + PCL818_CLRINT);	/* clear INT request */
-
-	if (!devpriv->ai_cmd_running || !devpriv->ai_mode) {
-		comedi_error(dev, "bad IRQ!");
-		return IRQ_NONE;
-	}
-
-	comedi_error(dev, "IRQ from unknown source!");
-	return IRQ_NONE;
+	outb(0, dev->iobase + PCL818_CLRINT);
+	return IRQ_HANDLED;
 }
 
 static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
-- 
1.8.5.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux