summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2014-10-22 15:36:24 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-29 16:03:10 +0800
commit5438da85fc482c63f7a6f93e5b07d7c55fc77135 (patch)
tree426c3a16050cc6485dedd39947b7ad6b8cba8b5c /drivers/staging/comedi/comedidev.h
parent0ca7f61cd67f7cd581bc6ba968072b4f7b0a2ef8 (diff)
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>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 9f4f9ef2b79a..eee4dd45a122 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -446,6 +446,8 @@ int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
unsigned int comedi_write_array_to_buffer(struct comedi_subdevice *s,
const void *data,
unsigned int num_bytes);
+unsigned int comedi_buf_write_samples(struct comedi_subdevice *s,
+ const void *data, unsigned int nsamples);
unsigned int comedi_buf_read_samples(struct comedi_subdevice *s,
void *data, unsigned int nsamples);