]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commit
staging: comedi: adv_pci1710: fix analog output readback value
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 5 Feb 2014 21:59:53 +0000 (14:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Feb 2014 20:41:27 +0000 (12:41 -0800)
commitdb438cf13a917c449d92c25deba7528fc323a43c
tree831c8d82de73007ebf2b828a719cd019f69233ed
parent88d48868cc91007df5f2b611df6fd843bdbd8dbe
staging: comedi: adv_pci1710: fix analog output readback value

commit 1e85c1ea1ff2a60659e790ef8ec76c7339445841 upstream.

The last value written to a analog output channel is cached in the
private data of this driver for readback.

Currently, the wrong value is cached in the (*insn_write) functions.
The current code stores the data[n] value for readback afer the loop
has written all the values. At this time 'n' points past the end of
the data array.

Fix the functions by using a local variable to hold the data being
written to the analog output channel. This variable is then used
after the loop is complete to store the readback value. The current
value is retrieved before the loop in case no values are actually
written..

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/adv_pci1710.c