From 6e2ebdf8720306d9aee47de4e050b41884de7e3d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 14 Aug 2015 15:23:31 -0700 Subject: [PATCH] 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index eea41e8ad1ac..39710f2297a6 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -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; } -- 2.30.2