staging: comedi: me_daq: fix me_ai_insn_read()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 7 Oct 2015 00:23:44 +0000 (17:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Oct 2015 05:56:26 +0000 (22:56 -0700)
commit651659c13353cb6a9eee4e94778b1708d3342dcf
treea11a010ee598a92b890579695512974bff02d812
parent8a844a91cab4556b7b7e336951623b394a80c934
staging: comedi: me_daq: fix me_ai_insn_read()

The comedi core expects (*insn_read) functions to return insn->n data
values. Refactor the function to work like the core expects. For
aesthetics, use the comedi_offset_munge() helper to munge the 2's
complement data.

This also fixes a minor issue when comedi_timeout() times out. Currently
this function just returns which leaves the ADC mode programmed for
software triggering. With the refactor the ADC mode is always disabled
when the function exits. This allows removing the unnecessary steps to
"stop any running conversions" at the start of the function.

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