diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-01-09 20:27:48 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-18 00:53:58 (GMT) |
commit | f8f76e909b8cc6696071e69cf4be07714c95bcb4 (patch) | |
tree | 92c1c24246f38177ce10f80f998ac07d933c18b2 /drivers/staging/comedi/comedidev.h | |
parent | 61c9fb0eb08bc9b7164a6181b0062d9959406a34 (diff) | |
download | linux-fsl-qoriq-f8f76e909b8cc6696071e69cf4be07714c95bcb4.tar.xz |
staging: comedi: comedi_buf: factor out common comedi_buf_write_alloc_* code
The only difference between comedi_buf_write_alloc() and the *_strict()
version is that the *_strict() one will only allocate the chunk if it
can completely fulfill the request.
Factor out the common code and add a flag parameter to indicate the 'strict'
usage. Change the exported functions so they are just wrappers around the
common function.
Cleanup the common function a bit and use the comedi_buf_write_n_available()
helper to determine the number of bytes available.
comedi_buf_write_n_available() is not used outside this module so make it
static. Since the only caller is __comedi_buf_write_alloc(), which will
always have a valid async pointer and already has a memory barrier, we
can remove the unnecessary (async == NULL) test as well as the smp_mb().
Also, the rounding of the sample size can be removed since the caller
does not need it.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-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.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index c3bc4b7..bf0fd8d 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -438,7 +438,6 @@ comedi_to_usb_interface(struct comedi_device *dev) int comedi_buf_put(struct comedi_async *async, short x); int comedi_buf_get(struct comedi_async *async, short *x); -unsigned int comedi_buf_write_n_available(struct comedi_async *async); unsigned int comedi_buf_write_alloc(struct comedi_async *async, unsigned int nbytes); unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async, |