summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott2014-05-06 14:12:08 +0200
committerGreg Kroah-Hartman2014-05-23 14:25:49 +0200
commitf1df8662859e7edee134d3d77f241a32c9cfb8ef (patch)
tree354e6bda1970f5e27eeae8019b290d793296fa98 /drivers
parentstaging: comedi: pass subdevice to comedi_buf_read_alloc() (diff)
downloadkernel-qcow2-linux-f1df8662859e7edee134d3d77f241a32c9cfb8ef.tar.gz
kernel-qcow2-linux-f1df8662859e7edee134d3d77f241a32c9cfb8ef.tar.xz
kernel-qcow2-linux-f1df8662859e7edee134d3d77f241a32c9cfb8ef.zip
staging: comedi: pass subdevice to comedi_buf_read_free()
Change the parameters of `comedi_buf_read_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 <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/comedi_buf.c5
-rw-r--r--drivers/staging/comedi/comedi_fops.c4
-rw-r--r--drivers/staging/comedi/comedidev.h2
-rw-r--r--drivers/staging/comedi/drivers/comedi_fc.c6
-rw-r--r--drivers/staging/comedi/drivers/mite.c2
5 files changed, 9 insertions, 10 deletions
diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c
index 07e0b3a51828..a3c3f21e77f9 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -398,9 +398,10 @@ static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async)
}
/* transfers control of a chunk from reader to free buffer space */
-unsigned int comedi_buf_read_free(struct comedi_async *async,
+unsigned int comedi_buf_read_free(struct comedi_subdevice *s,
unsigned int nbytes)
{
+ struct comedi_async *async = s->async;
unsigned int allocated;
/*
@@ -444,7 +445,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x)
return 0;
comedi_buf_read_alloc(s, sizeof(short));
*x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr);
- comedi_buf_read_free(async, sizeof(short));
+ comedi_buf_read_free(s, sizeof(short));
return 1;
}
EXPORT_SYMBOL_GPL(comedi_buf_get);
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 5164374f5ab2..365e191228be 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -994,7 +994,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) {
bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read);
- comedi_buf_read_free(async, bi.bytes_read);
+ comedi_buf_read_free(s, bi.bytes_read);
if (comedi_is_subdevice_idle(s) &&
async->buf_write_count == async->buf_read_count) {
@@ -2273,7 +2273,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
}
comedi_buf_read_alloc(s, n);
- comedi_buf_read_free(async, n);
+ comedi_buf_read_free(s, n);
count += n;
nbytes -= n;
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index d2131f26de53..c481620042ba 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -341,7 +341,7 @@ 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_subdevice *s, unsigned int n);
-unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);
+unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int n);
int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x);
diff --git a/drivers/staging/comedi/drivers/comedi_fc.c b/drivers/staging/comedi/drivers/comedi_fc.c
index 836eb1a37380..cf3da2cb0cc1 100644
--- a/drivers/staging/comedi/drivers/comedi_fc.c
+++ b/drivers/staging/comedi/drivers/comedi_fc.c
@@ -86,16 +86,14 @@ EXPORT_SYMBOL_GPL(cfc_write_array_to_buffer);
unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s,
void *data, unsigned int num_bytes)
{
- struct comedi_async *async = s->async;
-
if (num_bytes == 0)
return 0;
num_bytes = comedi_buf_read_alloc(s, num_bytes);
comedi_buf_memcpy_from(s, 0, data, num_bytes);
- comedi_buf_read_free(async, num_bytes);
+ comedi_buf_read_free(s, num_bytes);
cfc_inc_scan_progress(s, num_bytes);
- async->events |= COMEDI_CB_BLOCK;
+ s->async->events |= COMEDI_CB_BLOCK;
return num_bytes;
}
diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index d1423caecf7a..6c8bd7c33082 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -588,7 +588,7 @@ int mite_sync_output_dma(struct mite_channel *mite_chan,
return 0;
if (count) {
- comedi_buf_read_free(async, count);
+ comedi_buf_read_free(s, count);
async->events |= COMEDI_CB_BLOCK;
}
return 0;