From: H Hartley Sweeten Date: Mon, 19 Oct 2015 16:44:01 +0000 (-0700) Subject: staging: comedi: cb_pcidas: fix cb_pcidas_ao_nofifo_insn_write() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d52688055c9cdc81475882009e437248f073edf9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: comedi: cb_pcidas: fix cb_pcidas_ao_nofifo_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 --- diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 9e82fd24255f..58ba5533dc49 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -417,7 +417,9 @@ static int cb_pcidas_ao_nofifo_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; /* set channel and range */ spin_lock_irqsave(&dev->spinlock, flags); @@ -427,11 +429,12 @@ static int cb_pcidas_ao_nofifo_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_DATA_REG(chan)); + } - /* send data */ - outw(data[0], devpriv->pcibar4 + PCIDAS_AO_DATA_REG(chan)); + s->readback[chan] = val; return insn->n; }