summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-06-20 20:12:50 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-27 00:08:19 (GMT)
commit9504be8a1b84d5139f7475c0e705bc0630e82dc9 (patch)
treeb9cc98d22485d648062d56baaa1ec926cfbefcee
parentde91bb97254cec30f24b4f770e10eab7da3f6be1 (diff)
downloadlinux-9504be8a1b84d5139f7475c0e705bc0630e82dc9.tar.xz
staging: comedi: dt282x: fix dt282x_ao_insn_read()
The comedi core expects the (*insn_read) functions to return 'insn->n' samples. Fix this function to work like the core expects. For aesthetics, rename the private data 'ao' member to clarify its use. Also, remove the unnecessary comment. 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>
-rw-r--r--drivers/staging/comedi/drivers/dt282x.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
index d4164ce..f248dbc 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -326,7 +326,7 @@ struct dt282x_private {
const struct comedi_lrange *darangelist[2];
- unsigned short ao[2];
+ unsigned short ao_readback[2];
int dacsr; /* software copies of registers */
int adcsr;
@@ -828,21 +828,19 @@ static int dt282x_ai_cancel(struct comedi_device *dev,
return 0;
}
-/*
- * Analog output routine. Selects single channel conversion,
- * selects correct channel, converts from 2's compliment to
- * offset binary if necessary, loads the data into the DAC
- * data register, and performs the conversion.
- */
static int dt282x_ao_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
- struct comedi_insn *insn, unsigned int *data)
+ struct comedi_insn *insn,
+ unsigned int *data)
{
struct dt282x_private *devpriv = dev->private;
+ unsigned int chan = CR_CHAN(insn->chanspec);
+ int i;
- data[0] = devpriv->ao[CR_CHAN(insn->chanspec)];
+ for (i = 0; i < insn->n; i++)
+ data[i] = devpriv->ao_readback[chan];
- return 1;
+ return insn->n;
}
static int dt282x_ao_insn_write(struct comedi_device *dev,
@@ -869,7 +867,7 @@ static int dt282x_ao_insn_write(struct comedi_device *dev,
for (i = 0; i < insn->n; i++) {
val = data[i];
- devpriv->ao[chan] = val;
+ devpriv->ao_readback[chan] = val;
if (munge)
val = comedi_offset_munge(s, val);