From: H Hartley Sweeten Date: Mon, 25 Aug 2014 23:04:36 +0000 (-0700) Subject: staging: comedi: das08: fix bug in das08_ao_winsn() X-Git-Tag: firefly_0821_release~176^2~3121^2~1016 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=862f77363966434c35f1cbc17fcf1fe9cc9f497c;p=firefly-linux-kernel-4.4.55.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 03b2c71df8f8..9a5a06b79a61 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -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 {