mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinseob Kim <kimjinseob88@gmail.com>
To: jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: osf: keep the RAW cache current when the buffer is full
Date: Sun, 18 Oct 2026 18:27:05 +0900	[thread overview]
Message-ID: <36f5bc0a26aadf8f2208e6423c8a9847568ccd3d.1792315003.git.kimjinseob88@gmail.com> (raw)

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

             reply	other threads:[~2026-10-18  9:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18  9:27 Jinseob Kim [this message]
2026-10-24  2:36 ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36f5bc0a26aadf8f2208e6423c8a9847568ccd3d.1792315003.git.kimjinseob88@gmail.com \
    --to=kimjinseob88@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®