staging: comedi: pass subdevice to comedi_buf_reset()
authorIan Abbott <abbotti@mev.co.uk>
Tue, 6 May 2014 12:12:10 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:25:49 +0000 (21:25 +0900)
Change the parameters of `comedi_buf_reset()` to pass a pointer to the
comedi subdevice instead of a pointer to the "async" structure belonging
to the subdevice.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

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
drivers/staging/comedi/comedi_fops.c
drivers/staging/comedi/comedi_internal.h

index f295285d2aa6a155c2f1f911c53d3c2d38f43503..fa5d6d4d03518970bc3945c50ccd2f9af67cb749 100644 (file)
@@ -222,8 +222,10 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
        return 0;
 }
 
-void comedi_buf_reset(struct comedi_async *async)
+void comedi_buf_reset(struct comedi_subdevice *s)
 {
+       struct comedi_async *async = s->async;
+
        async->buf_write_alloc_count = 0;
        async->buf_write_count = 0;
        async->buf_read_alloc_count = 0;
index ada6024be6ee85820257c85d899acf1f5214bbb2..98229bd6cfb237e1ebef6e1676b8c6f687821ff9 100644 (file)
@@ -583,7 +583,7 @@ static void do_become_nonbusy(struct comedi_device *dev,
 
        comedi_set_subdevice_runflags(s, SRF_RUNNING, 0);
        if (async) {
-               comedi_buf_reset(async);
+               comedi_buf_reset(s);
                async->inttrig = NULL;
                kfree(async->cmd.chanlist);
                async->cmd.chanlist = NULL;
@@ -1557,7 +1557,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
                goto cleanup;
        }
 
-       comedi_buf_reset(async);
+       comedi_buf_reset(s);
 
        async->cb_mask =
            COMEDI_CB_EOA | COMEDI_CB_BLOCK | COMEDI_CB_ERROR |
index 36e7a99b5079d244b7e279a9771dac09d261818a..3cc81de03b56921a8cb62c92a81def3d4bdee45e 100644 (file)
@@ -15,7 +15,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s);
 
 int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s,
                     unsigned long new_size);
-void comedi_buf_reset(struct comedi_async *async);
+void comedi_buf_reset(struct comedi_subdevice *s);
 bool comedi_buf_is_mmapped(struct comedi_async *async);
 void comedi_buf_map_get(struct comedi_buf_map *bm);
 int comedi_buf_map_put(struct comedi_buf_map *bm);