From: H Hartley Sweeten Date: Mon, 14 Jul 2014 19:23:50 +0000 (-0700) Subject: staging: comedi: ni_mio_common: fix ni_ao_insn_read() X-Git-Tag: v3.17-rc1~123^2~682 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=47ef2541fefbff61d54b8bbb47ccc9cd736bb49e;p=karo-tx-linux.git staging: comedi: ni_mio_common: fix ni_ao_insn_read() The comedi core expects (*insn_read) functions to return insn->n data smaples. Fix this function to work like the core expects. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 1718382a7e7c..f4125c059d08 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2939,14 +2939,18 @@ static int ni_ao_config_chanlist(struct comedi_device *dev, } static int ni_ao_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { struct ni_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[chan]; - return 1; + return insn->n; } static int ni_ao_insn_write(struct comedi_device *dev,