Messages in this thread Patch in this message | | | From | Ben Hutchings <> | Date | Sun, 03 Feb 2019 14:45:08 +0100 | Subject | [PATCH 3.16 016/305] staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write() |
| |
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: H Hartley Sweeten <hsweeten@visionengravers.com>
commit e024181b02ed6b833358bede3f2d0c52cb5fb6bc upstream.
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 <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -640,7 +640,6 @@ static int daqp_ao_insn_write(struct com { struct daqp_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int val; int i; if (devpriv->stop) @@ -650,7 +649,8 @@ static int daqp_ao_insn_write(struct com 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);
| |