From: H Hartley Sweeten Date: Tue, 4 Nov 2014 17:53:50 +0000 (-0700) Subject: staging: comedi: addi_apci_3120: fix counter and external interrupt disable X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=dd62c4373ae1cd48d0f1561646443d2aed299e21;p=deliverable%2Flinux.git staging: comedi: addi_apci_3120: fix counter and external interrupt disable 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 93b17252a907..6eaf62ab5446 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;