staging: comedi: cb_pcidas: fix cb_pcidas_ao_fifo_insn_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 19 Oct 2015 16:44:00 +0000 (09:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:15:22 +0000 (19:15 -0700)
The comedi core expects (*insn_write) functions to write insn->n
data values to the hardware. 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/cb_pcidas.c

index 1e43c1a759d1e69115e3761620d4245266dddce9..9e82fd24255f4484079c85ff1c8751735957a064 100644 (file)
@@ -445,7 +445,9 @@ static int cb_pcidas_ao_fifo_insn_write(struct comedi_device *dev,
        struct cb_pcidas_private *devpriv = dev->private;
        unsigned int chan = CR_CHAN(insn->chanspec);
        unsigned int range = CR_RANGE(insn->chanspec);
+       unsigned int val = s->readback[chan];
        unsigned long flags;
+       int i;
 
        /* clear dac fifo */
        outw(0, devpriv->pcibar4 + PCIDAS_AO_FIFO_CLR_REG);
@@ -459,11 +461,12 @@ static int cb_pcidas_ao_fifo_insn_write(struct comedi_device *dev,
        outw(devpriv->ao_ctrl, devpriv->pcibar1 + PCIDAS_AO_REG);
        spin_unlock_irqrestore(&dev->spinlock, flags);
 
-       /* remember value for readback */
-       s->readback[chan] = data[0];
+       for (i = 0; i < insn->n; i++) {
+               val = data[i];
+               outw(val, devpriv->pcibar4 + PCIDAS_AO_FIFO_REG);
+       }
 
-       /* send data */
-       outw(data[0], devpriv->pcibar4 + PCIDAS_AO_FIFO_REG);
+       s->readback[chan] = val;
 
        return insn->n;
 }