]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: me_daq: use comedi_range_is_bipolar() helper
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 7 Oct 2015 00:23:40 +0000 (17:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 05:56:26 +0000 (22:56 -0700)
Use the helper function to determine if the dac bipolar bit needs
to be 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/me_daq.c

index a2b542ef8fd559c0e21642a3709856d044e04598..626109070422ff153fce9d16a25a9bee18f35677 100644 (file)
@@ -94,7 +94,6 @@
 #define   ME_DAC_CTRL_GAIN(x)          BIT(11 - ((x) & 0x3))
 #define   ME_DAC_CTRL_MASK(x)          (ME_DAC_CTRL_BIPOLAR(x) |       \
                                         ME_DAC_CTRL_GAIN(x))
-
 #define ME_DAC_DATA_A                  0x0014  /* - | W */
 #define ME_DAC_DATA_B                  0x0016  /* - | W */
 #define ME_DAC_DATA_C                  0x0018  /* - | W */
@@ -321,9 +320,8 @@ static int me_ao_insn_write(struct comedi_device *dev,
        /* Set dac-control register */
        devpriv->dac_ctrl &= ~ME_DAC_CTRL_MASK(chan);
        if (range == 0)
-               devpriv->dac_ctrl |= ME_DAC_CTRL_GAIN(chan) |
-                                    ME_DAC_CTRL_BIPOLAR(chan);
-       else if (range == 1)
+               devpriv->dac_ctrl |= ME_DAC_CTRL_GAIN(chan);
+       if (comedi_range_is_bipolar(s, range))
                devpriv->dac_ctrl |= ME_DAC_CTRL_BIPOLAR(chan);
        writew(devpriv->dac_ctrl, dev->mmio + ME_DAC_CTRL_REG);