]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: ni_mio_common: fix ni_ao_insn_read()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 14 Jul 2014 19:23:50 +0000 (12:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jul 2014 20:24:42 +0000 (13:24 -0700)
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 <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_common.c

index 1718382a7e7c2879a6e385d2d8cc5d63829fcf1f..f4125c059d08d8501a5d8efc3f86529fb212185a 100644 (file)
@@ -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,