From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:39199 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751662AbbDZJkB (ORCPT ); Sun, 26 Apr 2015 05:40:01 -0400 Subject: Patch "staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel" has been added to the 3.19-stable tree To: abbotti@mev.co.uk, gregkh@linuxfoundation.org Cc: , From: Date: Sun, 26 Apr 2015 11:39:49 +0200 Message-ID: <143004118921419@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel to the 3.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: staging-comedi-adv_pci1710-fix-ai-insn_read-for-non-zero-channel.patch and it can be found in the queue-3.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 27 Feb 2015 16:04:42 +0000 Subject: staging: comedi: adv_pci1710: fix AI INSN_READ for non-zero channel From: Ian Abbott commit abe46b8932dd9a6dfc3698e3eb121809b7b9ed28 upstream. Reading of analog input channels by the `INSN_READ` comedi instruction is broken for all except channel 0. `pci171x_ai_insn_read()` calls `pci171x_ai_read_sample()` 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_read_sample()` 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. Note that when the bug first appeared, it was `pci171x_ai_dropout()` that was called with the wrong parameter value. `pci171x_ai_dropout()` got replaced with `pci171x_ai_read_sample()` in commit 7fd2dae2500d ("staging: comedi: adv_pci1710: introduce pci171x_ai_read_sample()"). Fixes: 16c7eb6047bb ("staging: comedi: adv_pci1710: always enable PCI171x_PARANOIDCHECK code") Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adv_pci1710.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- 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 c 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 c 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; Patches currently in stable-queue which might be from abbotti@mev.co.uk are queue-3.19/staging-comedi-adv_pci1710-fix-ai-insn_read-for-non-zero-channel.patch