Re: [PATCH] media: pwm-ir-tx: Correct timer calculation

From: Thomas Weißschuh

Date: Wed Oct 14 2026 - 05:32:25 EST


On Wed, Oct 14, 2026 at 10:19:54AM +0100, Dave Stevenson wrote:
> Commit 44d7fb8acdf8 ("media: pwm-ir-tx: Avoid direct access to
> hrtimer clockbase") converted a loop conditional from
> now = timer->base->get_time();
> } while (hrtimer_get_expires_tv64(timer) < now);
> to
> while (hrtimer_expires_remaining(timer) > 0);
>
> hrtimer_expires_remaining returns (expires - now), so the
> change has inverted the condition.
>
> Convert back to follow the original pattern, but using the
> proper API call.
>
> Fixes: 44d7fb8acdf8 ("media: pwm-ir-tx: Avoid direct access to hrtimer clockbase")
> Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>

Thanks!

Cc: stable@xxxxxxxxxxxxxxx
Closes: https://github.com/raspberrypi/linux/issues/7678
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

For the Cc stable see:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html#option-1

> ---
> Reported via https://github.com/raspberrypi/linux/issues/7678
> ---
> drivers/media/rc/pwm-ir-tx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c
> index 047472dc9244..bffdda489950 100644
> --- a/drivers/media/rc/pwm-ir-tx.c
> +++ b/drivers/media/rc/pwm-ir-tx.c
> @@ -138,7 +138,7 @@ static enum hrtimer_restart pwm_ir_timer(struct hrtimer *timer)
> hrtimer_add_expires_ns(timer, ns);
>
> pwm_ir->txbuf_index++;
> - } while (hrtimer_expires_remaining(timer) > 0);
> + } while (hrtimer_get_expires(timer) < hrtimer_cb_get_time(timer));
>
> return HRTIMER_RESTART;
> }
>
> ---
> base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
> change-id: 20261013-media-rc-pwm-ir-tx-971c2ae8cf53
>
> Best regards,
> --
> Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx>
>