[PATCH 10/14] staging: comedi: me_daq: use comedi_range_is_bipolar() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the helper function to determine if the dac bipolar bit needs
to be set.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 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 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);
 
-- 
2.5.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux