[PATCH v2 08/37] staging: comedi: das1800: use comedi_offset_munge() for analog output

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

 



The analog outputs expect 2's complement data. For aesthetics, use
the helper function to handle the munging instead of depending on
the boardinfo 'resolution'.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/das1800.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 6795f3e..f870824 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1132,8 +1132,7 @@ static int das1800_ao_insn_write(struct comedi_device *dev,
 	unsigned short output;
 	unsigned long irq_flags;
 
-	/*   card expects two's complement data */
-	output = data[0] - (1 << (board->resolution - 1));
+	output = comedi_offset_munge(s, data[0]);
 	/*  if the write is to the 'update' channel, we need to remember its value */
 	if (chan == update_chan)
 		devpriv->ao_update_bits = output;
-- 
2.6.3

_______________________________________________
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