]> git.karo-electronics.de Git - linux-beck.git/commit
staging: comedi: comedi_buf: introduce comedi_buf_read_samples()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 22 Oct 2014 21:36:34 +0000 (14:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2014 08:01:19 +0000 (16:01 +0800)
commit4455d7c351dada63ec031a82760fa00d7806139a
tree1d3f8a925daf344922506a92f1584e6f00b42dc8
parent22be3f81429608aad8229ee60e8f834024291f09
staging: comedi: comedi_buf: introduce comedi_buf_read_samples()

Introduce a generic method to read samples from the async buffer.

The number of requested samples is clampled to the number of samples that
would fill the async buffer. The size of each sample is determined using
the bytes_per_sample() helper. The number of bytes need are then read
from the async buffer using comedi_read_array_from_buffer().

This will allow converting all the comedi drivers to use a common method
to read data from the async buffer.

Since comedi_read_array_from_buffer() sets the COMEDI_CB_BLOCK event after
reading the data, those events can be removed from the drivers.

In addition, comedi_inc_scan_progress() will automatically detect the end of
scan and set the COMEDI_CB_EOS event. Those events can also be removed from
the drivers.

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/comedi_buf.c
drivers/staging/comedi/comedidev.h