mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 15:49:42 -04:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c3f7e15383
commit
1271dd24c6
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user