diff options
author | Jonathan Cameron | 2011-05-18 15:40:55 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2011-05-20 01:06:12 +0200 |
commit | a7348347ba8a4a961a88434d37e45a8bd98a47b0 (patch) | |
tree | 7fa8e32b722db5eb49df9e93f9eac3cd3001d34d /drivers/staging/iio/ring_sw.c | |
parent | staging:iio: remove ability to escalate events. (diff) | |
download | kernel-qcow2-linux-a7348347ba8a4a961a88434d37e45a8bd98a47b0.tar.gz kernel-qcow2-linux-a7348347ba8a4a961a88434d37e45a8bd98a47b0.tar.xz kernel-qcow2-linux-a7348347ba8a4a961a88434d37e45a8bd98a47b0.zip |
staging:iio: Add polling of events on the ring access chrdev.
Staging one of combining the ring chrdevs.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/ring_sw.c')
-rw-r--r-- | drivers/staging/iio/ring_sw.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/iio/ring_sw.c b/drivers/staging/iio/ring_sw.c index 000481421e49..53c677434071 100644 --- a/drivers/staging/iio/ring_sw.c +++ b/drivers/staging/iio/ring_sw.c @@ -12,6 +12,7 @@ #include <linux/module.h> #include <linux/device.h> #include <linux/workqueue.h> +#include <linux/sched.h> #include <linux/poll.h> #include "ring_sw.h" #include "trigger.h" @@ -136,6 +137,8 @@ static int iio_store_to_sw_ring(struct iio_sw_ring_buffer *ring, ret = __iio_push_event(&ring->buf.ev_int, code, timestamp); + ring->buf.stufftoread = true; + wake_up_interruptible(&ring->buf.pollq); } return ret; } @@ -261,6 +264,10 @@ int iio_read_first_n_sw_rb(struct iio_ring_buffer *r, ret = -EFAULT; goto error_free_data_cpy; } + + if (bytes_to_rip >= ring->buf.length*ring->buf.bytes_per_datum/2) + ring->buf.stufftoread = 0; + error_free_data_cpy: kfree(data); error_ret: @@ -310,6 +317,7 @@ int iio_request_update_sw_rb(struct iio_ring_buffer *r) int ret = 0; struct iio_sw_ring_buffer *ring = iio_to_sw_ring(r); + r->stufftoread = false; spin_lock(&ring->use_lock); if (!ring->update_needed) goto error_ret; |