staging: comedi: pcl726: tidy up pcl726_ao_insn_read()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 25 Sep 2013 22:36:13 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Sep 2013 16:32:18 +0000 (09:32 -0700)
Tidy up this function to follow the normal form for analog output
read back functions.

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/pcl726.c

index fa14f3e90f8a08d0eb7788df96115dc66d6428ef..492d28929f54111dce53b3dc021110efd346e9df 100644 (file)
@@ -216,15 +216,17 @@ static int pcl726_ao_insn_write(struct comedi_device *dev,
 
 static int pcl726_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 pcl726_private *devpriv = dev->private;
-       int chan = CR_CHAN(insn->chanspec);
-       int n;
+       unsigned int chan = CR_CHAN(insn->chanspec);
+       int i;
+
+       for (i = 0; i < insn->n; i++)
+               data[i] = devpriv->ao_readback[chan];
 
-       for (n = 0; n < insn->n; n++)
-               data[n] = devpriv->ao_readback[chan];
-       return n;
+       return insn->n;
 }
 
 static int pcl726_di_insn_bits(struct comedi_device *dev,