Re: [PATCH] iio: osf: keep the RAW cache current when the buffer is full
From: Jonathan Cameron
Date: Fri Oct 23 2026 - 22:36:49 EST
On Sun, 18 Oct 2026 18:27:05 +0900
Jinseob Kim <kimjinseob88@xxxxxxxxx> wrote:
> A full IIO software kfifo returns -EBUSY from the buffer push. The
> sample handler currently treats that as an application rejection and
> returns before publishing the valid sample to the direct-read cache.
> Consequently RAW values and the last accepted sequence remain stale
> while a consumer is not draining the buffer.
>
> Continue cache admission for this normal saturation condition. Keep
> other push failures as errors, and retain all sample, scale and session
> validation before publication. The buffered sample is still dropped
> when the kfifo is full; subsequent samples can be queued after it drains.
>
> Fixes: 2da37c28edc6 ("iio: osf: add IIO devices from capability reports")
Not a useful tag as I'll be rebasing.
Given this will go upstream with the driver anyway I've just dropped it.
Applied without that or the LLM tag (change of kernel policy).
Thanks,
Jonathan
> Assisted-by: LLM
> Signed-off-by: Jinseob Kim <kimjinseob88@xxxxxxxxx>
> ---
> drivers/iio/sensorhubs/osf/osf_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/sensorhubs/osf/osf_core.c b/drivers/iio/sensorhubs/osf/osf_core.c
> index 4f73ff5e9572b95e1cd237671f01e149784b92b5..377645e7a8a31c60bb719b7c98e3230f04725f1c 100644
> --- a/drivers/iio/sensorhubs/osf/osf_core.c
> +++ b/drivers/iio/sensorhubs/osf/osf_core.c
> @@ -231,7 +231,8 @@ static int osf_core_handle_sensor_sample(struct osf_device *osf,
> return -EPROTO;
>
> ret = osf_iio_push_sample(indio_dev, values, sample.channel_count);
> - if (ret) {
> + /* A full software buffer must not prevent the direct-read cache update. */
> + if (ret && ret != -EBUSY) {
> dev_err_ratelimited(osf->dev,
> "failed to push sensor %#x:%u sample: %d\n",
> sample.sensor_type, sample.sensor_index, ret);
>
> base-commit: 6a27f3a7d1063aec5aa3d9370161e850fc3a85dd