Skip to content

Commit

Permalink
iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() wh…
Browse files Browse the repository at this point in the history
…en 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>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Feb 8, 2014
1 parent 6b89db3 commit f25330f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/iio/magnetometer/mag3110.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit f25330f

Please sign in to comment.