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

staging: comedi: pass subdevice to __comedi_buf_write_alloc()

Local function `__comedi_buf_write_alloc()` is called by
`comedi_buf_write_alloc()` and `comedi_buf_put()`.  It 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 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 5b108588
...@@ -250,10 +250,11 @@ static unsigned int comedi_buf_write_n_available(struct comedi_async *async) ...@@ -250,10 +250,11 @@ static unsigned int comedi_buf_write_n_available(struct comedi_async *async)
return free_end - async->buf_write_alloc_count; return free_end - async->buf_write_alloc_count;
} }
static unsigned int __comedi_buf_write_alloc(struct comedi_async *async, static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s,
unsigned int nbytes, unsigned int nbytes,
int strict) int strict)
{ {
struct comedi_async *async = s->async;
unsigned int available = comedi_buf_write_n_available(async); unsigned int available = comedi_buf_write_n_available(async);
if (nbytes > available) if (nbytes > available)
...@@ -274,7 +275,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_async *async, ...@@ -274,7 +275,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_async *async,
unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s,
unsigned int nbytes) unsigned int nbytes)
{ {
return __comedi_buf_write_alloc(s->async, nbytes, 0); return __comedi_buf_write_alloc(s, nbytes, 0);
} }
EXPORT_SYMBOL_GPL(comedi_buf_write_alloc); EXPORT_SYMBOL_GPL(comedi_buf_write_alloc);
...@@ -427,7 +428,7 @@ EXPORT_SYMBOL_GPL(comedi_buf_read_free); ...@@ -427,7 +428,7 @@ EXPORT_SYMBOL_GPL(comedi_buf_read_free);
int comedi_buf_put(struct comedi_subdevice *s, unsigned short x) int comedi_buf_put(struct comedi_subdevice *s, unsigned short x)
{ {
struct comedi_async *async = s->async; struct comedi_async *async = s->async;
unsigned int n = __comedi_buf_write_alloc(async, sizeof(short), 1); unsigned int n = __comedi_buf_write_alloc(s, sizeof(short), 1);
if (n < sizeof(short)) { if (n < sizeof(short)) {
async->events |= COMEDI_CB_ERROR; async->events |= COMEDI_CB_ERROR;
......
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