On Mon, Aug 28, 2023 at 11:53:59AM +0100, Jonathan Cameron wrote:
Can we use iio_device_claim_buffer_mode() here? I believe that has the right handling even though I don't think we've used it to protect iio_push_* before. Normally it's about enforcing we stay in the mode if the read out of a channel needs to be handled differently in a read_raw() callback.
if (iio_device_claim_buffer_mode(indio_dev) < 0) { /* Not in buffer mode so fine to drop out - we got -EBUSY*/ return 0; } //Otherwise mlock is held - though that's an implementation detail all we care about is we can't exit buffer mode. ... iio_push_... iio_device_release_buffer_mode(indio_dev); return 0;
Ack, fix it in v2(https://patchwork.kernel.org/project/linux-iio/patch/20230829030622.1571852-...).