]> git.karo-electronics.de Git - linux-beck.git/commit
staging: comedi: das1800: tidy up das1800_ai_transfer_size()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 13 Jan 2015 17:16:44 +0000 (10:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 22:31:31 +0000 (14:31 -0800)
commit5e5a21cf8e7756f668e7eb51ba99619136b79c4d
treeb97322e342154e2ecacb0de1bb1eb45ab611b5fe
parent620ec185a208f5bf54af46912ae75a330697bd3f
staging: comedi: das1800: tidy up das1800_ai_transfer_size()

For aesthetics, pass the fill time 'ns' as a parameter to this function.

Refactor this function to calculate the transfer size in 'samples' instead
of 'bytes'. This removes the need to constantly multiply the values by the
'sample_size'. It also helps avoid any possible integer overflow issues.

Use the comedi_nsamples_left() helper to limit the samples when cmd->stop_src
is TRIG_COUNT.

Use comedi_samples_to_bytes() to return the final DMA size in bytes.

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