From: H Hartley Sweeten Date: Fri, 8 Apr 2016 19:41:37 +0000 (-0700) Subject: staging: comedi: das1800: use comedi_offset_munge() for analog output X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=90f39b9f996a6de8da850a71502ab2bef24cfe9b;p=linux-beck.git staging: comedi: das1800: use comedi_offset_munge() for analog output 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 6795f3e03d1a..f870824ecf19 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;