staging: comedi: hwdrv_apci1564: fix counter "mode" setting
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 7 Aug 2015 18:45:12 +0000 (11:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:34:57 +0000 (18:34 -0700)
According to the (broken) original driver, data[4] passed to this function
is the "timer mode". It appears the original code used the wrong shift to
set the bits.

Use the ADDI_TCW_CTRL_MODE() macro so that the correct bits get set.

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 a1f4ae19c024adc1530b2ecc29124a8356bac794..dc738b26c60a7824221fe3ec3a31b1bfbd9c1070 100644 (file)
@@ -116,7 +116,7 @@ static int apci1564_counter_insn_config(struct comedi_device *dev,
        ctrl &= ~(ADDI_TCW_CTRL_EXT_CLK_MASK | ADDI_TCW_CTRL_MODE_MASK |
                  ADDI_TCW_CTRL_TIMER_ENA | ADDI_TCW_CTRL_RESET_ENA |
                  ADDI_TCW_CTRL_WARN_ENA);
-       ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_EXT_CLK(data[4]);
+       ctrl |= ADDI_TCW_CTRL_CNTR_ENA | ADDI_TCW_CTRL_MODE(data[4]);
        outl(ctrl, iobase + ADDI_TCW_CTRL_REG);
 
        /* Enable or Disable Interrupt */