From: Jonathan Cameron <jic23@kernel.org>
To: Md Shofiqul Islam <shofiqtest@gmail.com>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de,
andy.shevchenko@gmail.com, david.lechner@sifive.com,
mike@mikelooijmans.nl
Subject: Re: [PATCH v4] iio: adc: ti-ads1298: Fix incorrect timeout comment
Date: Mon, 11 May 2026 18:50:38 +0100 [thread overview]
Message-ID: <20260511185038.2c367a9f@jic23-huawei> (raw)
In-Reply-To: <20260510193435.4602-1-shofiqtest@gmail.com>
On Sun, 10 May 2026 22:34:35 +0300
Md Shofiqul Islam <shofiqtest@gmail.com> wrote:
> At the lowest supported data rate of 250Hz, one conversion period is
> 4ms, not 40ms. The 50ms timeout is deliberately conservative to allow
> for kernel scheduling latency, which can be significant under load or
> on slow machines.
>
> Fix the comment to state the correct conversion time, use "lowest sample
> rate" for clarity, and explain that the extra margin exists to absorb
> scheduling latency so that no one is tempted to shrink the timeout to
> match the conversion period.
>
> Also drop the redundant ret variable assignment by using the return value
> of wait_for_completion_timeout() directly in the if() condition.
>
> Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
Hi. Please slow down a bit and perhaps more importantly be careful
with your various series numbers etc. I see the same patch in a series
label v4 then as a patch on it's own labelled v2, one labelled v3 and
2 patches labeled v4 sent a few minute apart
I'm going to pick up the most recent one probably but that might
well be the wrong one!
> ---
> Changes in v4:
> - Drop the ret assignment for wait_for_completion_timeout(); use the
> return value directly in the if() condition (Andy Shevchenko)
>
> Changes in v3:
> - Fix multi-line comment style: move comment text to its own line
> after '/*' (Andy Shevchenko)
>
> Changes in v2:
> - Correct conversion time to 4ms (was wrong 40ms), add scheduling
> latency explanation, clarify "lowest sample rate" (David Lechner,
> Andy Shevchenko)
>
> drivers/iio/adc/ti-ads1298.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads1298.c b/drivers/iio/adc/ti-ads1298.c
> index ae30b47e45..25261163d3 100644
> --- a/drivers/iio/adc/ti-ads1298.c
> +++ b/drivers/iio/adc/ti-ads1298.c
> @@ -210,9 +210,11 @@ static int ads1298_read_one(struct ads1298_private *priv, int chan_index)
> return ret;
> }
>
> - /* Cannot take longer than 40ms (250Hz) */
> - ret = wait_for_completion_timeout(&priv->completion, msecs_to_jiffies(50));
> - if (!ret)
> + /*
> + * One conversion takes at most 4ms at the lowest sample rate (250Hz).
> + * Use 50ms to allow for kernel scheduling latency.
> + */
> + if (!wait_for_completion_timeout(&priv->completion, msecs_to_jiffies(50)))
> return -ETIMEDOUT;
>
> return 0;
next prev parent reply other threads:[~2026-05-11 17:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260509071910.12345-1-shofiqtest@gmail.com>
2026-05-10 8:45 ` [PATCH v2] iio: adc: ti-ads1298: Fix incorrect timeout comment Md Shofiqul Islam
2026-05-10 10:16 ` Andy Shevchenko
2026-05-10 12:38 ` [PATCH v3] " Md Shofiqul Islam
2026-05-10 13:01 ` Andy Shevchenko
2026-05-10 19:34 ` [PATCH v4] " Md Shofiqul Islam
2026-05-11 17:50 ` Jonathan Cameron [this message]
2026-05-10 19:36 ` Md Shofiqul Islam
2026-05-11 16:03 ` 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=20260511185038.2c367a9f@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=david.lechner@sifive.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=mike@mikelooijmans.nl \
--cc=shofiqtest@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.