]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: comedi_buf: introduce comedi_buf_write_samples()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 22 Oct 2014 22:36:24 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2014 08:03:10 +0000 (16:03 +0800)
commitcb386ceea5ee6848795c916a72c5beece8b31051
tree426c3a16050cc6485dedd39947b7ad6b8cba8b5c
parent370c6e0a8dc0ec7cc9abb535c0e5bda0b3715fd3
staging: comedi: comedi_buf: introduce comedi_buf_write_samples()

Introduce a generic method to write samples to the async buffer.

The number of samples is first checked against the number of samples that
would fill the async buffer. The size of each sample is determined using
the bytes_per_sample() helper. If all the samples will fit in the async
buffer they are written to the buffer using comedi_write_array_to_buffer().

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

Since comedi_write_array_to_buffer() sets the COMEDI_CB_BLOCK event after
writing 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