From: Jonathan Cameron <jic23@kernel.org>
To: "Luca Weiss" <luca.weiss@fairphone.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Documentation of iio_read_channel_processed return value
Date: Sun, 9 Nov 2025 17:14:22 +0000 [thread overview]
Message-ID: <20251109171422.0463d885@jic23-huawei> (raw)
In-Reply-To: <DE3I8OHQQD0F.2VTQS2PET9MI0@fairphone.com>
On Sat, 08 Nov 2025 18:55:08 +0100
"Luca Weiss" <luca.weiss@fairphone.com> wrote:
> Hi all,
>
> I've noticed that the docstring in include/linux/iio/consumer.h for
> iio_read_channel_processed (and likely some other functions in there) is
> wrong because it's saying "Returns an error code or 0." while often it's
> returning e.g. IIO_VAL_INT. In some code paths it's actually returning 0
> but it seems in standard cases it's not.
Hmm. Looks like we have a bug in handling the path that ends up in iio_multiple_value()
I think we just want to change iio_read_channel_processed_scale() to check
that the return value of iio_mutliple_value() < 0 and return ret if so, otherwise
return 0
So to me smells like a bug and the documentation is correct.
Good catch, perhaps spin a patch like the above? This is made more complex
because a few drivers seem to assume IIO_INT_VAL such as iio/afe/iio-rescale.c so
we will need to fix those up as well.
J
>
> Could the docstring please be updated so this is clear to users of this
> function? I don't understand IIO well enough to confidently propose
> changes there myself.
>
> Thanks and kind regards
> Luca
prev parent reply other threads:[~2025-11-09 17:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-08 17:55 Luca Weiss
2025-11-09 17:14 ` Jonathan Cameron [this message]
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=20251109171422.0463d885@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--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®