From ef7e20934ec906e7986566d45ea8ae652a64ba09 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Mon, 19 Oct 2015 09:44:00 -0700 Subject: [PATCH] staging: comedi: cb_pcidas: fix cb_pcidas_ao_fifo_insn_write() 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 1e43c1a..9e82fd2 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -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; } -- 2.7.4