From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938641AbcKNURF (ORCPT ); Mon, 14 Nov 2016 15:17:05 -0500 Received: from smtp81.iad3a.emailsrvr.com ([173.203.187.81]:48082 "EHLO smtp81.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937229AbcKNUQh (ORCPT ); Mon, 14 Nov 2016 15:16:37 -0500 X-Auth-ID: abbotti@mev.co.uk X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: devel@driverdev.osuosl.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , linux-kernel@vger.kernel.org, "# 4 . 7+" Subject: [PATCH 1/3] staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask Date: Mon, 14 Nov 2016 20:16:21 +0000 Message-Id: <20161114201623.18161-2-abbotti@mev.co.uk> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161114201623.18161-1-abbotti@mev.co.uk> References: <20161114201623.18161-1-abbotti@mev.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 817144ae7fda ("staging: comedi: ni_mio_common: remove unnecessary use of 'board->adbits'") Signed-off-by: Ian Abbott Cc: # 4.7+ --- Needs backporting to stable kernels >= 3.17 --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 9812508..9543539 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1832,7 +1832,7 @@ static int ni_ai_insn_read(struct comedi_device *dev, unsigned int *data) { struct ni_private *devpriv = dev->private; - unsigned int mask = (s->maxdata + 1) >> 1; + unsigned int mask = s->maxdata; int i, n; unsigned int signbits; unsigned int d; -- 2.10.2