summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers/me4000.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-08-05 10:44:52 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-07 15:03:28 -0700
commit518c5b64f6014192e5f9bc3bb1ebf2311e14b621 (patch)
tree8ef853781b0a4ee1cdfe82dfda1a19a294b5d92d /drivers/staging/comedi/drivers/me4000.c
parent245bd462440ca5914286c71051fdc5af506e76cb (diff)
staging: comedi: me4000: fix ai_write_chanlist()
Rename this function so it has namespace associated with the driver. The last entry of the chanlist needs the ME4000_AI_LIST_LAST_ENTRY bit set to end the list. Fix the function and tidy if up a bit. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/me4000.c')
-rw-r--r--drivers/staging/comedi/drivers/me4000.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 1001d6379480..5b798a63589b 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -652,25 +652,26 @@ static void ai_write_timer(struct comedi_device *dev,
outl(chan_ticks - 1, dev->iobase + ME4000_AI_CHAN_TIMER_REG);
}
-static int ai_write_chanlist(struct comedi_device *dev,
- struct comedi_subdevice *s, struct comedi_cmd *cmd)
+static int me4000_ai_write_chanlist(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_cmd *cmd)
{
- unsigned int entry;
- unsigned int chan;
- unsigned int rang;
- unsigned int aref;
int i;
for (i = 0; i < cmd->chanlist_len; i++) {
- chan = CR_CHAN(cmd->chanlist[i]);
- rang = CR_RANGE(cmd->chanlist[i]);
- aref = CR_AREF(cmd->chanlist[i]);
+ unsigned int chan = CR_CHAN(cmd->chanlist[i]);
+ unsigned int range = CR_RANGE(cmd->chanlist[i]);
+ unsigned int aref = CR_AREF(cmd->chanlist[i]);
+ unsigned int entry;
- entry = chan | ME4000_AI_LIST_RANGE(rang);
+ entry = chan | ME4000_AI_LIST_RANGE(range);
if (aref == AREF_DIFF)
entry |= ME4000_AI_LIST_INPUT_DIFFERENTIAL;
+ if (i == (cmd->chanlist_len - 1))
+ entry |= ME4000_AI_LIST_LAST_ENTRY;
+
outl(entry, dev->iobase + ME4000_AI_CHANNEL_LIST_REG);
}
@@ -738,7 +739,7 @@ static int ai_prepare(struct comedi_device *dev,
outl(tmp, dev->iobase + ME4000_AI_CTRL_REG);
/* Write the channel list */
- ai_write_chanlist(dev, s, cmd);
+ me4000_ai_write_chanlist(dev, s, cmd);
return 0;
}