diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-10-22 14:36:41 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-29 16:01:19 +0800 |
commit | 109bf06e2a88a04607c93d8223e4be0af09ebc8c (patch) | |
tree | cd65b729f4352fddd31d607fbfc33a964c7231a8 /drivers/staging | |
parent | 2b3e13b8605ee0915804ce73d6e5e4e72fc51ba2 (diff) |
staging: comedi: comedi_buf: absorb comedi_read_array_from_buffer()
This function is only called by comedi_buf_read_samples(). Absorb it.
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')
-rw-r--r-- | drivers/staging/comedi/comedi_buf.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index d1303a831462..9074da2cbe0a 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -549,22 +549,6 @@ unsigned int comedi_write_array_to_buffer(struct comedi_subdevice *s, } EXPORT_SYMBOL_GPL(comedi_write_array_to_buffer); -static unsigned int comedi_read_array_from_buffer(struct comedi_subdevice *s, - void *data, - unsigned int num_bytes) -{ - if (num_bytes == 0) - return 0; - - num_bytes = comedi_buf_read_alloc(s, num_bytes); - comedi_buf_memcpy_from(s, 0, data, num_bytes); - comedi_buf_read_free(s, num_bytes); - comedi_inc_scan_progress(s, num_bytes); - s->async->events |= COMEDI_CB_BLOCK; - - return num_bytes; -} - /** * comedi_buf_read_samples - read sample data from comedi buffer * @s: comedi_subdevice struct @@ -587,7 +571,15 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s, nsamples = max_samples; nbytes = nsamples * bytes_per_sample(s); + if (nbytes == 0) + return 0; - return comedi_read_array_from_buffer(s, data, nbytes); + nbytes = comedi_buf_read_alloc(s, nbytes); + comedi_buf_memcpy_from(s, 0, data, nbytes); + comedi_buf_read_free(s, nbytes); + comedi_inc_scan_progress(s, nbytes); + s->async->events |= COMEDI_CB_BLOCK; + + return nbytes; } EXPORT_SYMBOL_GPL(comedi_buf_read_samples); |