summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-10-06 17:23:40 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-12 22:56:26 -0700
commit99104f62f018df989dc4bdd7c452b2e4e8b266e9 (patch)
tree130770e0f098796af6360340f5cbc22adeb1201c
parent46ada8afc8fdd2788db152ceb0fc001f46072dfe (diff)
downloadop-kernel-dev-99104f62f018df989dc4bdd7c452b2e4e8b266e9.zip
op-kernel-dev-99104f62f018df989dc4bdd7c452b2e4e8b266e9.tar.gz
staging: comedi: me_daq: use comedi_range_is_bipolar() helper
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>
-rw-r--r--drivers/staging/comedi/drivers/me_daq.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c
index a2b542e..6261090 100644
--- a/drivers/staging/comedi/drivers/me_daq.c
+++ b/drivers/staging/comedi/drivers/me_daq.c
@@ -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);
OpenPOWER on IntegriCloud