Re: [PATCH 2/3] hwmon: (tmp108) Fix jiffies wraparound in conversion-ready check

From: Guenter Roeck

Date: Fri Sep 25 2026 - 23:26:55 EST


On Fri, Sep 25, 2026 at 08:23:23PM +0200, Tom Verdonck wrote:
> tmp108 records a one-shot deadline in ->ready_time at probe (and resume)
> and, on every temperature read, refuses the read with -EAGAIN while
> time_before(jiffies, ready_time) is true, in order to skip the initial
> conversion.
>
> ->ready_time is an unsigned long compared with time_before(), whose
> signed difference is only meaningful while the two values are within
> LONG_MAX jiffies of each other. Because ->ready_time is set once and
> never refreshed, jiffies keeps advancing away from it, and after 2^31
> jiffies the difference flips sign. On a 32-bit HZ=100 kernel that
> happens ~248.5 days after boot: time_before() then permanently reports
> "not ready" and the driver returns -EAGAIN on every read, without ever
> touching the sensor, until the next reboot. The continuous-mode path,
> which sets ->ready_time to jiffies with no added conversion delay, wraps
> the same way.
>
> Store the deadline as a 64-bit jiffies value and compare it with
> get_jiffies_64()/time_before64(), which does not wrap in any practical
> uptime.
>
> Fixes: 66e1c9171339 ("hwmon: Add Texas Instruments TMP108 temperature sensor driver.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Tom Verdonck <tom.verdonck@xxxxxxxxxxx>

Applied.

Thanks,
Guenter