summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-10-01 21:59:00 +0100
committerJonathan Cameron <jic23@kernel.org>2014-02-08 10:06:22 +0000
commitf25330f63edd8e2d02ca76ed43fc852d4d76bb12 (patch)
treef0b27bfe90a8958df46870f750081d069abadd9f /drivers/iio
parent6b89db36b3ab7c4b99027873e1de4be8d07387d4 (diff)
downloadlinux-f25330f63edd8e2d02ca76ed43fc852d4d76bb12.tar.gz
linux-f25330f63edd8e2d02ca76ed43fc852d4d76bb12.tar.bz2
linux-f25330f63edd8e2d02ca76ed43fc852d4d76bb12.zip
iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is enabled
individual reads are not permitted concurrently with buffered reads Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/magnetometer/mag3110.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index 4b65b6d3bdb1..b88cb44f87ce 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -154,6 +154,9 @@ static int mag3110_read_raw(struct iio_dev *indio_dev,
switch (mask) {
case IIO_CHAN_INFO_RAW:
+ if (iio_buffer_enabled(indio_dev))
+ return -EBUSY;
+
switch (chan->type) {
case IIO_MAGN: /* in 0.1 uT / LSB */
ret = mag3110_read(data, buffer);
@@ -199,6 +202,9 @@ static int mag3110_write_raw(struct iio_dev *indio_dev,
struct mag3110_data *data = iio_priv(indio_dev);
int rate;
+ if (iio_buffer_enabled(indio_dev))
+ return -EBUSY;
+
switch (mask) {
case IIO_CHAN_INFO_SAMP_FREQ:
rate = mag3110_get_samp_freq_index(data, val, val2);