commit abe46b8932dd upstream
Reading of analog input channels by the `INSN_READ` comedi instruction
is broken for all except channel 0. `pci171x_insn_read_ai()` calls
`pci171x_ai_dropout()` with the wrong value for the third parameter. It
is supposed to be the current index in a channel list (which is always
of length 1 in this case, so the index should be 0), but instead it is
passing the actual channel number. `pci171x_ai_dropout()` checks the
channel number encoded in the raw sample value read from the hardware
matches the channel number stored in the specified index of the
previously set up channel list and returns `-ENODATA` if it doesn't
match. Since the index should always be 0 in this case, the match will
fail unless the channel number is also 0. Fix it by passing 0 as the
channel index.
Fixes: 16c7eb6047bb ("staging: comedi: adv_pci1710: always enable
PCI171x_PARANOIDCHECK code")
Signed-off-by: Ian Abbott <[email protected]>
---
Sorry, the original upstream commit didn't apply!
---
drivers/staging/comedi/drivers/adv_pci1710.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c
b/drivers/staging/comedi/drivers/adv_pci1710.c
index d02df7d..57b7bc2 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -455,7 +455,6 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
struct comedi_insn *insn, unsigned int *data)
{
struct pci1710_private *devpriv = dev->private;
- unsigned int chan = CR_CHAN(insn->chanspec);
int ret = 0;
int i;
@@ -477,7 +476,7 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,
break;
val = inw(dev->iobase + PCI171x_AD_DATA);
- ret = pci171x_ai_dropout(dev, s, chan, val);
+ ret = pci171x_ai_dropout(dev, s, 0, val);
if (ret)
break;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html