staging: comedi: rti800: swap val and mask when reading ai data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Apr 2013 01:21:02 +0000 (18:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Apr 2013 23:29:25 +0000 (16:29 -0700)
The (mask & val) operation when reading the high 4-bits of the analog
data looks strange. Change it to (val & mask).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/rti800.c

index d788c19e7fb1c79ada911696f0c4eadea863ead6..0084038a8b0df4f7cd8f47d211b10312b57cb02f 100644 (file)
@@ -217,7 +217,7 @@ static int rti800_ai_insn_read(struct comedi_device *dev,
                        return ret;
 
                data[i] = inb(dev->iobase + RTI800_ADCLO);
-               data[i] |= (0xf & inb(dev->iobase + RTI800_ADCHI)) << 8;
+               data[i] |= (inb(dev->iobase + RTI800_ADCHI) & 0xf) << 8;
 
                if (devpriv->adc_2comp)
                        data[i] ^= 0x800;