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

H Hartley Sweeten hsweeten at visionengravers.com
Tue Mar 4 18:29:47 UTC 2014


If an async ai command is not running or the int816_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 at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/pcl816.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c
index e77bf9f..632a4a4 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -344,8 +344,8 @@ static irqreturn_t interrupt_pcl816(int irq, void *d)
 	struct comedi_device *dev = d;
 	struct pcl816_private *devpriv = dev->private;
 
-	if (!dev->attached) {
-		comedi_error(dev, "premature interrupt");
+	if (!dev->attached || !devpriv->ai_cmd_running ||
+	    !devpriv->int816_mode) {
 		outb(0, dev->iobase + PCL816_CLRINT);
 		return IRQ_HANDLED;
 	}
@@ -362,13 +362,8 @@ static irqreturn_t interrupt_pcl816(int irq, void *d)
 		return interrupt_pcl816_ai_mode13_dma(irq, d);
 	}
 
-	outb(0, dev->iobase + PCL816_CLRINT);	/* clear INT request */
-	if (!devpriv->ai_cmd_running || !devpriv->int816_mode) {
-		comedi_error(dev, "bad IRQ!");
-		return IRQ_NONE;
-	}
-	comedi_error(dev, "IRQ from unknown source!");
-	return IRQ_NONE;
+	outb(0, dev->iobase + PCL816_CLRINT);
+	return IRQ_HANDLED;
 }
 
 static int pcl816_ai_cmdtest(struct comedi_device *dev,
-- 
1.8.5.2



More information about the devel mailing list