Change the parameters of `comedi_buf_write_free()` 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 <abbo...@mev.co.uk>
---
 drivers/staging/comedi/comedi_buf.c                       | 5 +++--
 drivers/staging/comedi/comedi_fops.c                      | 4 ++--
 drivers/staging/comedi/comedidev.h                        | 2 +-
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c | 2 +-
 drivers/staging/comedi/drivers/comedi_fc.c                | 2 +-
 drivers/staging/comedi/drivers/mite.c                     | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/comedi_buf.c 
b/drivers/staging/comedi/comedi_buf.c
index 6a65500..2208168 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -329,9 +329,10 @@ unsigned int comedi_buf_write_n_allocated(struct 
comedi_async *async)
 }
 
 /* transfers a chunk from writer to filled buffer space */
-unsigned int comedi_buf_write_free(struct comedi_async *async,
+unsigned int comedi_buf_write_free(struct comedi_subdevice *s,
                                   unsigned int nbytes)
 {
+       struct comedi_async *async = s->async;
        unsigned int allocated = comedi_buf_write_n_allocated(async);
 
        if (nbytes > allocated)
@@ -426,7 +427,7 @@ int comedi_buf_put(struct comedi_subdevice *s, unsigned 
short x)
                return 0;
        }
        *(unsigned short *)(async->prealloc_buf + async->buf_write_ptr) = x;
-       comedi_buf_write_free(async, sizeof(short));
+       comedi_buf_write_free(s, sizeof(short));
        return 1;
 }
 EXPORT_SYMBOL_GPL(comedi_buf_put);
diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 65135c1..5262543 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1004,7 +1004,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
        if (bi.bytes_written && (s->subdev_flags & SDF_CMD_WRITE)) {
                bi.bytes_written =
                    comedi_buf_write_alloc(s, bi.bytes_written);
-               comedi_buf_write_free(async, bi.bytes_written);
+               comedi_buf_write_free(s, bi.bytes_written);
        }
 
 copyback_position:
@@ -2166,7 +2166,7 @@ static ssize_t comedi_write(struct file *file, const char 
__user *buf,
                        n -= m;
                        retval = -EFAULT;
                }
-               comedi_buf_write_free(async, n);
+               comedi_buf_write_free(s, n);
 
                count += n;
                nbytes -= n;
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index b47cc96..4a795e0 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -337,7 +337,7 @@ static inline unsigned int bytes_per_sample(const struct 
comedi_subdevice *subd)
 int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev);
 
 unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int 
n);
-unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int);
+unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n);
 
 unsigned int comedi_buf_read_n_available(struct comedi_async *);
 unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
index 246220a..f540394 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c
@@ -2716,7 +2716,7 @@ static int i_APCI3200_InterruptHandleEos(struct 
comedi_device *dev)
                                ui_ScanValueArray, (7 + 12) * sizeof(unsigned 
int));
 
                        /*  Update comedi buffer pinters indexes */
-                       comedi_buf_write_free(s->async,
+                       comedi_buf_write_free(s,
                                (7 + 12) * sizeof(unsigned int));
 
                        /*  Send events */
diff --git a/drivers/staging/comedi/drivers/comedi_fc.c 
b/drivers/staging/comedi/drivers/comedi_fc.c
index 21cf34e..a7860a4 100644
--- a/drivers/staging/comedi/drivers/comedi_fc.c
+++ b/drivers/staging/comedi/drivers/comedi_fc.c
@@ -75,7 +75,7 @@ unsigned int cfc_write_array_to_buffer(struct 
comedi_subdevice *s,
        }
 
        comedi_buf_memcpy_to(s, 0, data, num_bytes);
-       comedi_buf_write_free(async, num_bytes);
+       comedi_buf_write_free(s, num_bytes);
        cfc_inc_scan_progress(s, num_bytes);
        async->events |= COMEDI_CB_BLOCK;
 
diff --git a/drivers/staging/comedi/drivers/mite.c 
b/drivers/staging/comedi/drivers/mite.c
index a5999f5..e33c03d 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -550,7 +550,7 @@ int mite_sync_input_dma(struct mite_channel *mite_chan,
        if (count <= 0)
                return 0;
 
-       comedi_buf_write_free(async, count);
+       comedi_buf_write_free(s, count);
        cfc_inc_scan_progress(s, count);
        async->events |= COMEDI_CB_BLOCK;
        return 0;
-- 
1.9.2

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to