From: H Hartley Sweeten Date: Mon, 25 Aug 2014 23:04:33 +0000 (-0700) Subject: staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write() X-Git-Tag: v3.18-rc1~130^2~1019 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e024181b02ed6b833358bede3f2d0c52cb5fb6bc;p=karo-tx-linux.git staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write() The comedi core expects (*insn_write) functions to write insn->n values to the hardware and return the number of values written. Currently, this function only writes the first value. Fix it 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/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index b1db61d9d834..489f4c8ab862 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -638,7 +638,6 @@ static int daqp_ao_insn_write(struct comedi_device *dev, { struct daqp_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int val; int i; if (devpriv->stop) @@ -648,7 +647,8 @@ static int daqp_ao_insn_write(struct comedi_device *dev, outb(0, dev->iobase + DAQP_AUX); for (i = 0; i > insn->n; i++) { - val = data[0]; + unsigned val = data[i]; + val &= 0x0fff; val ^= 0x0800; /* Flip the sign */ val |= (chan << 12);