staging: comedi: dt2814: Clear stale AI data before operation
authorIan Abbott <abbotti@mev.co.uk>
Mon, 1 Mar 2021 16:57:52 +0000 (16:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:25:31 +0000 (09:25 +0100)
commit7a3f3a7005cba9cfc1a0d50978f3eb7f3094e02f
treef4c8f5c28f3fdb988ff41f598c29b7a17e604829
parenta0d1a3864cad089eef3e0458d1abc31e9e101751
staging: comedi: dt2814: Clear stale AI data before operation

When performing a Comedi read instruction or setting up an asynchronous
command on the AI subdevice, clear any stale data on the A/D registers
by waiting for the Status register's BUSY bit to clear (if set) and then
if the FINISH or ERR bit is set, reading the A/D Data register twice to
clear the stale data.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20210301165757.243065-2-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dt2814.c