staging: comedi: pcl816: fix short DMA transactions
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 12 Jan 2015 17:56:04 +0000 (10:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 22:25:21 +0000 (14:25 -0800)
commitceb41be712b68fac4ac834120a80fc3cb8e5ac37
tree368ceb7b9fe2e53a82874d5c7a7c326a88e22b42
parenta2c3966d18a93540f49c2c8cc3dda5ce6c9399a7
staging: comedi: pcl816: fix short DMA transactions

When the cmd->stop_src == TRIG_COUNT the last DMA transfer might be smaller
than the buffer size. This results in invalid data being added to the async
buffer.

Add a 'size' member to the DMA descriptor and initialize it with the
actual size of the DMA transfer. Use that in interrupt and ai subdevice
(*poll) function to return the proper number of samples. Use the
comedi_bytes_to_samples() helper to convert the byte size to comedi
samples in the interrupt handler.

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