Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754886AbbFERib (ORCPT ); Fri, 5 Jun 2015 13:38:31 -0400 Received: from smtp81.iad3a.emailsrvr.com ([173.203.187.81]:39521 "EHLO smtp81.iad3a.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932670AbbFERa4 (ORCPT ); Fri, 5 Jun 2015 13:30:56 -0400 X-Sender-Id: abbotti@mev.co.uk From: Ian Abbott To: Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten , Subject: [PATCH 07/32] staging: comedi: das08: rename DAS08_LSB and DAS08_MSB Date: Fri, 5 Jun 2015 18:30:10 +0100 Message-Id: <1433525435-12986-8-git-send-email-abbotti@mev.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1433525435-12986-1-git-send-email-abbotti@mev.co.uk> References: <1433525435-12986-1-git-send-email-abbotti@mev.co.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3013 Lines: 76 The `DAS08_LSB` and `DAS08_MSB` macros contain the offsets to the least-significant and most-significant analog input data registers. Rename them to `DAS08_AI_LSB_REG` and `DAS08_AI_MSB_REG` respectively and add comments to document them. Signed-off-by: Ian Abbott --- drivers/staging/comedi/drivers/das08.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 2521352..1d9e6a6 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -42,8 +42,20 @@ */ -#define DAS08_LSB 0 -#define DAS08_MSB 1 +/* + * Data format of DAS08_AI_LSB_REG and DAS08_AI_MSB_REG depends on + * 'ai_encoding' member of board structure: + * + * das08_encode12 : DATA[11..4] = MSB[7..0], DATA[3..0] = LSB[7..4]. + * das08_pcm_encode12 : DATA[11..8] = MSB[3..0], DATA[7..9] = LSB[7..0]. + * das08_encode16 : SIGN = MSB[7], MAGNITUDE[14..8] = MSB[6..0], + * MAGNITUDE[7..0] = LSB[7..0]. + * SIGN==0 for negative input, SIGN==1 for positive input. + * Note: when read a second time after conversion + * complete, MSB[7] is an "over-range" bit. + */ +#define DAS08_AI_LSB_REG 0x00 /* (R) AI least significant bits */ +#define DAS08_AI_MSB_REG 0x01 /* (R) AI most significant bits */ #define DAS08_TRIG_12BIT 1 #define DAS08_STATUS 2 #define DAS08_EOC (1<<7) @@ -214,8 +226,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, range = CR_RANGE(insn->chanspec); /* clear crap */ - inb(dev->iobase + DAS08_LSB); - inb(dev->iobase + DAS08_MSB); + inb(dev->iobase + DAS08_AI_LSB_REG); + inb(dev->iobase + DAS08_AI_MSB_REG); /* set multiplexer */ /* lock to prevent race with digital output */ @@ -235,7 +247,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, for (n = 0; n < insn->n; n++) { /* clear over-range bits for 16-bit boards */ if (thisboard->ai_nbits == 16) - if (inb(dev->iobase + DAS08_MSB) & 0x80) + if (inb(dev->iobase + DAS08_AI_MSB_REG) & 0x80) dev_info(dev->class_dev, "over-range\n"); /* trigger conversion */ @@ -245,8 +257,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, if (ret) return ret; - msb = inb(dev->iobase + DAS08_MSB); - lsb = inb(dev->iobase + DAS08_LSB); + msb = inb(dev->iobase + DAS08_AI_MSB_REG); + lsb = inb(dev->iobase + DAS08_AI_LSB_REG); if (thisboard->ai_encoding == das08_encode12) { data[n] = (lsb >> 4) | (msb << 4); } else if (thisboard->ai_encoding == das08_pcm_encode12) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/