summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorJosselin Costanzi <josselin.costanzi@mobile-devices.fr>2015-03-22 20:33:38 +0200
committerJonathan Cameron <jic23@kernel.org>2015-03-29 16:17:09 +0100
commit37d3455672732b29a477732a94abfe95e199f0ce (patch)
treea2e4920bbecaec6f3773cbc5a7228d17283b7d21 /drivers/staging/iio
parent9444a300c2be3ce6266462e3171ceb6636cc62e8 (diff)
iio: add watermark logic to iio read and poll
Currently the IIO buffer blocking read only wait until at least one data element is available. This patch makes the reader sleep until enough data is collected before returning to userspace. This should limit the read() calls count when trying to get data in batches. Co-author: Yannick Bedhomme <yannick.bedhomme@mobile-devices.fr> Signed-off-by: Josselin Costanzi <josselin.costanzi@mobile-devices.fr> [rebased and remove buffer timeout] Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/accel/sca3000_ring.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/accel/sca3000_ring.c b/drivers/staging/iio/accel/sca3000_ring.c
index f76a26885808..8589eade1057 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -129,9 +129,9 @@ error_ret:
return ret ? ret : num_read;
}
-static bool sca3000_ring_buf_data_available(struct iio_buffer *r)
+static size_t sca3000_ring_buf_data_available(struct iio_buffer *r)
{
- return r->stufftoread;
+ return r->stufftoread ? r->watermark : 0;
}
/**