On Thu, 16 Feb 2023 06:00:00 -0800 Lars-Peter Clausen <lars@xxxxxxxxxx> wrote: > On 2/16/23 02:14, Nuno Sá wrote: > > For output buffers, there's no guarantee that the buffer won't be full > > in the first iteration of the loop in which case we would block > > independently of userspace passing O_NONBLOCK or not. Fix it by always > > checking the flag before going to sleep. > > > > While at it (and as it's a bit related), refactored the loop so that the > > stop condition is 'written != n', i.e, run the loop until all data has > > been copied into the IIO buffers. This makes the code a bit simpler. > > > > Fixes: 9eeee3b0bf190 ("iio: Add output buffer support") > > Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx> > > Reviewed-by: Lars-Peter Clausen <lars@xxxxxxxxxx> > Applied to the fixes-togreg branch of iio.git and marked for stable. Thanks, Jonathan