]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
iio:magnetometer:mag3110: Report busy in _read_raw() / write_raw() when buffer is...
authorPeter Meerwald <pmeerw@pmeerw.net>
Wed, 1 Oct 2014 20:59:00 +0000 (21:59 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 8 Feb 2014 10:06:22 +0000 (10:06 +0000)
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>
drivers/iio/magnetometer/mag3110.c

index 4b65b6d3bdb17696027f58c34887befaaa209671..b88cb44f87ce6c205addbac271404b0340f70bc6 100644 (file)
@@ -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);