Commit 5283a7be authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask

commit 655c4d44 upstream.

For NI M Series cards, the Comedi `insn_read` handler for the AI
subdevice is broken due to ANDing the value read from the AI FIFO data
register with an incorrect mask.  The incorrect mask clears all but the
most significant bit of the sample data.  It should preserve all the
sample data bits.  Correct it.

Fixes: 817144ae ("staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'")
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e692edec
...@@ -1929,7 +1929,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, ...@@ -1929,7 +1929,7 @@ static int ni_ai_insn_read(struct comedi_device *dev,
unsigned int *data) unsigned int *data)
{ {
struct ni_private *devpriv = dev->private; struct ni_private *devpriv = dev->private;
unsigned int mask = (s->maxdata + 1) >> 1; unsigned int mask = s->maxdata;
int i, n; int i, n;
unsigned signbits; unsigned signbits;
unsigned int d; unsigned int d;
......
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