staging: comedi: hwdrv_apci1564: tidy up apci1564_counter_insn_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 7 Aug 2015 18:45:13 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:34:57 +0000 (18:34 -0700)
Clear the gate and trig bits in the common code path.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c

index dc738b26c60a7824221fe3ec3a31b1bfbd9c1070..1315554fb0962d635f01169acba230dd07f5c239 100644 (file)
@@ -147,16 +147,15 @@ static int apci1564_counter_insn_write(struct comedi_device *dev,
        unsigned int ctrl;
 
        ctrl = inl(iobase + ADDI_TCW_CTRL_REG);
+       ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG);
        switch (data[1]) {
        case 0: /* Stops the Counter subdevice */
                ctrl = 0;
                break;
        case 1: /* Start the Counter subdevice */
-               ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG);
                ctrl |= ADDI_TCW_CTRL_ENA;
                break;
        case 2: /* Clears the Counter subdevice */
-               ctrl &= ~(ADDI_TCW_CTRL_GATE | ADDI_TCW_CTRL_TRIG);
                ctrl |= ADDI_TCW_CTRL_GATE;
                break;
        }