diff options
author | Jonathan Cameron | 2011-02-11 14:09:09 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-02-18 22:22:50 +0100 |
commit | d5857d65b5f7fab78c69da4085f0ce85a0399b25 (patch) | |
tree | f6c9dc35ce16ef374a85867fc6f4d8287aa86769 /drivers/staging/iio/industrialio-ring.c | |
parent | staging: iio: ak8975: add platform data. (diff) | |
download | kernel-qcow2-linux-d5857d65b5f7fab78c69da4085f0ce85a0399b25.tar.gz kernel-qcow2-linux-d5857d65b5f7fab78c69da4085f0ce85a0399b25.tar.xz kernel-qcow2-linux-d5857d65b5f7fab78c69da4085f0ce85a0399b25.zip |
staging:iio:buffering move the copy to user on rip down into implementations
The current interface is not as adaptable as it should be. Moving
this complexity into the implementations makes it easier to add
new implementations.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Tested-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/industrialio-ring.c')
-rw-r--r-- | drivers/staging/iio/industrialio-ring.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/drivers/staging/iio/industrialio-ring.c b/drivers/staging/iio/industrialio-ring.c index 9a98fcdbe109..bd4373ae066b 100644 --- a/drivers/staging/iio/industrialio-ring.c +++ b/drivers/staging/iio/industrialio-ring.c @@ -16,7 +16,6 @@ #include <linux/kernel.h> #include <linux/device.h> #include <linux/fs.h> -#include <linux/poll.h> #include <linux/cdev.h> #include <linux/slab.h> @@ -98,31 +97,13 @@ static ssize_t iio_ring_rip_outer(struct file *filp, char __user *buf, size_t count, loff_t *f_ps) { struct iio_ring_buffer *rb = filp->private_data; - int ret, dead_offset, copied; - u8 *data; + int ret, dead_offset; + /* rip lots must exist. */ if (!rb->access.rip_lots) return -EINVAL; - copied = rb->access.rip_lots(rb, count, &data, &dead_offset); + ret = rb->access.rip_lots(rb, count, buf, &dead_offset); - if (copied <= 0) { - ret = copied; - goto error_ret; - } - if (copy_to_user(buf, data + dead_offset, copied)) { - ret = -EFAULT; - goto error_free_data_cpy; - } - /* In clever ring buffer designs this may not need to be freed. - * When such a design exists I'll add this to ring access funcs. - */ - kfree(data); - - return copied; - -error_free_data_cpy: - kfree(data); -error_ret: return ret; } |