On Wed, 28 Apr 2021 13:05:38 +0200 Sean Nyekjaer <sean@xxxxxxxxxx> wrote: > On 28/04/2021 10.22, Sean Nyekjaer wrote: > > |@@ -433,7 +450,10 @@ static int fxls8962af_read_raw(struct iio_dev > > *indio_dev, ret = fxls8962af_get_temp(data, val); break; case > > IIO_ACCEL: - ret = fxls8962af_get_axis(data, chan, val); + if > > (iio_buffer_enabled(indio_dev))| > |Seeing the iio_device_claim_direct_mode() is doing exactly the same > check :)| And in a race free fashion ;) > > |+ ret = -EBUSY; + else + ret = fxls8962af_get_axis(data, chan, val); > > break; default: ret = -EINVAL;| >