staging: comedi: pass subdevice to comedi_buf_write_n_available()
authorIan Abbott <abbotti@mev.co.uk>
Tue, 6 May 2014 12:12:14 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:25:50 +0000 (21:25 +0900)
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: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_buf.c

index 5be91cd88cc3776f03963a6c355d7a3598e9f7e5..df4a9c4bca35187f83fb34dfa88e2ec862e5a425 100644 (file)
@@ -243,8 +243,9 @@ void comedi_buf_reset(struct comedi_subdevice *s)
        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;
 
        return free_end - async->buf_write_alloc_count;
@@ -255,7 +256,7 @@ static unsigned int __comedi_buf_write_alloc(struct comedi_subdevice *s,
                                             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(s);
 
        if (nbytes > available)
                nbytes = strict ? 0 : available;