Re: [PATCH v3] iio: adc: ti-ads1298: Fix incorrect timeout comment

From: Andy Shevchenko

Date: Sun May 10 2026 - 09:02:16 EST


On Sun, May 10, 2026 at 03:38:01PM +0300, Md Shofiqul Islam 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.
>
> Signed-off-by: Md Shofiqul Islam <shofiqtest@xxxxxxxxx>
> ---

Here should be a changelog. What's different to v2 to v1?

> - /* Cannot take longer than 40ms (250Hz) */
> + /*
> + * One conversion takes at most 4ms at the lowest sample rate (250Hz).
> + * Use 50ms to allow for kernel scheduling latency.
> + */
> ret = wait_for_completion_timeout(&priv->completion, msecs_to_jiffies(50));
> if (!ret)
> return -ETIMEDOUT;

It's also better to drop a ret assignment here as it's counter intuitive.

if (!wait_for_completion_timeout(&priv->completion, msecs_to_jiffies(50)))
return -ETIMEDOUT;

(This might require more changes related to this ret drop.)

--
With Best Regards,
Andy Shevchenko