mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: osf: keep the RAW cache current when the buffer is full
@ 2026-10-18  9:27 Jinseob Kim
  2026-10-24  2:36 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Jinseob Kim @ 2026-10-18  9:27 UTC (permalink / raw)
  To: jic23; +Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel

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")
Assisted-by: LLM
Signed-off-by: Jinseob Kim <kimjinseob88@gmail.com>
---
 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-24  2:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-18  9:27 [PATCH] iio: osf: keep the RAW cache current when the buffer is full Jinseob Kim
2026-10-24  2:36 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®