Commit a1c0e5fe authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: pass subdevice to comedi_buf_write_n_available()

Local function `comedi_buf_write_n_available()` currently takes a
pointer to a `struct comedi_async`.  Change it to take a pointer to a
`struct comedi_subdevice` and use the `async` member for consistency
with the other comedi buffer handling functions.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8ab4fe7e
...@@ -243,8 +243,9 @@ void comedi_buf_reset(struct comedi_subdevice *s) ...@@ -243,8 +243,9 @@ void comedi_buf_reset(struct comedi_subdevice *s)
async->events = 0; async->events = 0;
} }
static unsigned int comedi_buf_write_n_available(struct comedi_async *async) static unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s)
{ {
struct comedi_async *async = s->async;
unsigned int free_end = async->buf_read_count + async->prealloc_bufsz; unsigned int free_end = async->buf_read_count + async->prealloc_bufsz;
return free_end - async->buf_write_alloc_count; return free_end - async->buf_write_alloc_count;
...@@ -255,7 +256,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s, ...@@ -255,7 +256,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s,
int strict) int strict)
{ {
struct comedi_async *async = s->async; struct comedi_async *async = s->async;
unsigned int available = comedi_buf_write_n_available(async); unsigned int available = comedi_buf_write_n_available(s);
if (nbytes > available) if (nbytes > available)
nbytes = strict ? 0 : available; nbytes = strict ? 0 : available;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment