[PATCH 006/108] staging: comedi: addi_apci_3120: fix counter and external interrupt disable

H Hartley Sweeten hsweeten at visionengravers.com
Tue Nov 4 17:53:50 UTC 2014


The APCI3120_DISABLE_ALL_TIMER define define is not needed, and it's used
incorrectly in apci3120_cancel(). The define is a mask of the bits needed
to disable the counters. Writing the value directly sets unintended bits.

Prior to writing the value, the 'devpriv->us_OutputRegister' is set to 0
and written to the register. This disables all the timers and the external
trigger.

Remove the unnecessary apci3120_exttrig_disable() call as well as the write
of APCI3120_DISABLE_ALL_TIMER.

In apci3120_interrupt(), remove the unnecessary mask and write to disable
all the timers. The COMEDI_CB_EOA event will cause the core to call the
(*cancel) operation which will disable the timers.

Remove the unused define.

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>
---
 .../comedi/drivers/addi-data/hwdrv_apci3120.c       | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index 93b1725..6eaf62a 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -167,9 +167,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
 
 #define APCI3120_TIMER2_SELECT_EOS	0xc0
 #define APCI3120_COUNTER		3
-#define APCI3120_DISABLE_ALL_TIMER	(APCI3120_DISABLE_TIMER0 &	\
-					 APCI3120_DISABLE_TIMER1 &	\
-					 APCI3120_DISABLE_TIMER2)
 
 /* ANALOG INPUT RANGE */
 static const struct comedi_lrange range_apci3120_ai = {
@@ -613,16 +610,9 @@ static int apci3120_cancel(struct comedi_device *dev,
 	/* Disable BUS Master PCI */
 	outl(0, devpriv->amcc + AMCC_OP_REG_MCSR);
 
-	/* Disable ext trigger */
-	apci3120_exttrig_disable(dev);
-
+	/* stop all counters and disable external trigger */
 	devpriv->us_OutputRegister = 0;
-	/* stop  counters */
-	outw(devpriv->
-		us_OutputRegister & APCI3120_DISABLE_TIMER0 &
-		APCI3120_DISABLE_TIMER1, dev->iobase + APCI3120_WR_ADDRESS);
-
-	outw(APCI3120_DISABLE_ALL_TIMER, dev->iobase + APCI3120_WR_ADDRESS);
+	outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS);
 
 	/* DISABLE_ALL_INTERRUPT */
 	outb(APCI3120_DISABLE_ALL_INTERRUPT,
@@ -1346,13 +1336,6 @@ static irqreturn_t apci3120_interrupt(int irq, void *d)
 			outb(devpriv->b_ModeSelectRegister,
 				dev->iobase + APCI3120_WRITE_MODE_SELECT);
 
-			/*  stop timer 2 */
-			devpriv->us_OutputRegister =
-				devpriv->
-				us_OutputRegister & APCI3120_DISABLE_ALL_TIMER;
-			outw(devpriv->us_OutputRegister,
-				dev->iobase + APCI3120_WR_ADDRESS);
-
 			s->async->events |= COMEDI_CB_EOA;
 			break;
 
-- 
2.0.3



More information about the devel mailing list