From 99104f62f018df989dc4bdd7c452b2e4e8b266e9 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 6 Oct 2015 17:23:40 -0700 Subject: [PATCH] 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me_daq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index a2b542ef8fd5..626109070422 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); -- 2.30.2