summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorIan Abbott2015-10-09 13:26:48 +0200
committerGreg Kroah-Hartman2015-10-13 19:28:40 +0200
commit274ec5ee5478f1757ba083e366d9490dfaa6bd2f (patch)
tree43175d6993165fdda1ed665835b7f6990704962d /drivers/staging/comedi
parentstaging: comedi: don't poll_wait on same subdevice twice (diff)
downloadkernel-qcow2-linux-274ec5ee5478f1757ba083e366d9490dfaa6bd2f.tar.gz
kernel-qcow2-linux-274ec5ee5478f1757ba083e366d9490dfaa6bd2f.tar.xz
kernel-qcow2-linux-274ec5ee5478f1757ba083e366d9490dfaa6bd2f.zip
staging: comedi: rename comedi_buf_write_n_available
Rename the local function `comedi_buf_write_n_available()` to `comedi_buf_write_n_unalloc()`. It is the amount of unallocated space available in the buffer that is available to be allocated for writing and does not include the space that has already been allocated for writing. This is unlike the exported function `comedi_buf_read_n_available()` which includes the space available to be allocated for reading plus the space already allocated for reading. The new name breaks the unintentional naming symmetry (and also clears the way for the old name to be reused for a new function). Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/comedi_buf.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
index d45a4b65e8d3..4837559ac6b8 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -245,7 +245,7 @@ void comedi_buf_reset(struct comedi_subdevice *s)
async->events = 0;
}
-static unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s)
+static unsigned int comedi_buf_write_n_unalloc(struct comedi_subdevice *s)
{
struct comedi_async *async = s->async;
unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
@@ -268,10 +268,10 @@ unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s,
unsigned int nbytes)
{
struct comedi_async *async = s->async;
- unsigned int available = comedi_buf_write_n_available(s);
+ unsigned int unalloc = comedi_buf_write_n_unalloc(s);
- if (nbytes > available)
- nbytes = available;
+ if (nbytes > unalloc)
+ nbytes = unalloc;
async->buf_write_alloc_count += nbytes;
@@ -557,8 +557,7 @@ unsigned int comedi_buf_write_samples(struct comedi_subdevice *s,
* If not, clamp the nsamples to the number that will fit, flag the
* buffer overrun and add the samples that fit.
*/
- max_samples = comedi_bytes_to_samples(s,
- comedi_buf_write_n_available(s));
+ max_samples = comedi_bytes_to_samples(s, comedi_buf_write_n_unalloc(s));
if (nsamples > max_samples) {
dev_warn(s->device->class_dev, "buffer overrun\n");
s->async->events |= COMEDI_CB_OVERFLOW;