Commit 1271dd24 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c3f7e153
...@@ -655,11 +655,9 @@ static int daqp_ao_insn_write(struct comedi_device *dev, ...@@ -655,11 +655,9 @@ static int daqp_ao_insn_write(struct comedi_device *dev,
s->readback[chan] = val; s->readback[chan] = val;
val &= 0x0fff; /* write the two's complement value to the channel */
val ^= 0x0800; /* Flip the sign */ outw((chan << 12) | comedi_offset_munge(s, val),
val |= (chan << 12); dev->iobase + DAQP_DA);
outw(val, dev->iobase + DAQP_DA);
} }
return insn->n; return insn->n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment