Commit 6e2ebdf8 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: usbdux: use comedi_offset_munge()

Use the comedi_offset_munge() helper to convert the hardware two's
complement values to the offset binary format expected by comedi.
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 2779b7e5
......@@ -266,7 +266,7 @@ static void usbduxsub_ai_handle_urb(struct comedi_device *dev,
/* bipolar data is two's-complement */
if (comedi_range_is_bipolar(s, range))
val ^= ((s->maxdata + 1) >> 1);
val = comedi_offset_munge(s, val);
/* transfer data */
if (!comedi_buf_write_samples(s, &val, 1))
......@@ -776,7 +776,7 @@ static int usbdux_ai_insn_read(struct comedi_device *dev,
/* bipolar data is two's-complement */
if (comedi_range_is_bipolar(s, range))
val ^= ((s->maxdata + 1) >> 1);
val = comedi_offset_munge(s, val);
data[i] = val;
}
......
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