summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-10-06 00:22:51 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-13 07:16:05 +0300
commit1271dd24c63478b08fc574ec8b4fa50902b368f0 (patch)
treeb1e7297a9f9672484b251e7f8ad294a71955ace8
parentc3f7e15383a9e86a56820c34d5ef761c4682e47b (diff)
downloadlinux-1271dd24c63478b08fc574ec8b4fa50902b368f0.tar.xz
staging: comedi: quatech_daqp_cs: use comedi_offset_munge() in ao (*insn_write)
Use the comedi_offset_munge() helper to do the offset binary to two's complement conversion when writing a new analog output value. 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/quatech_daqp_cs.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index cf144ce553c1..4f87147213d1 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -655,11 +655,9 @@ static int daqp_ao_insn_write(struct comedi_device *dev,
s->readback[chan] = val;
- val &= 0x0fff;
- val ^= 0x0800; /* Flip the sign */
- val |= (chan << 12);
-
- outw(val, dev->iobase + DAQP_DA);
+ /* write the two's complement value to the channel */
+ outw((chan << 12) | comedi_offset_munge(s, val),
+ dev->iobase + DAQP_DA);
}
return insn->n;