Commit 862f7736 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das08: fix bug in das08_ao_winsn()

The comedi core expects (*insn_write) functions to write insn->n values
to the hardware and return the number of values written.

Currently, this function only writes the first value. Fix it to work
like the core expects.

For aesthetics, rename the function and tidy it up a bit.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 073d4632
......@@ -369,19 +369,18 @@ static void das08_ao_initialize(struct comedi_device *dev,
das08_ao_set_data(dev, n, data);
}
static int das08_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
static int das08_ao_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
unsigned int n;
unsigned int chan;
chan = CR_CHAN(insn->chanspec);
unsigned int chan = CR_CHAN(insn->chanspec);
int i;
for (n = 0; n < insn->n; n++)
das08_ao_set_data(dev, chan, *data);
for (i = 0; i < insn->n; i++)
das08_ao_set_data(dev, chan, data[i]);
return n;
return insn->n;
}
static int das08_ao_rinsn(struct comedi_device *dev,
......@@ -498,7 +497,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
s->n_chan = 2;
s->maxdata = (1 << thisboard->ao_nbits) - 1;
s->range_table = &range_bipolar5;
s->insn_write = das08_ao_winsn;
s->insn_write = das08_ao_insn_write;
s->insn_read = das08_ao_rinsn;
das08_ao_initialize(dev, s);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment