From 14198d61243a25085d5d12cb509ddfe7b8a5bd59 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Sat, 14 Jun 2025 10:55:55 -0700 Subject: [PATCH] clocksource/drivers/timer-tegra186: Avoid 64-bit divide operation Building the driver on xtensa fails with: tensa-linux-ld: drivers/clocksource/timer-tegra186.o: in function `tegra186_timer_remove': timer-tegra186.c:(.text+0x350): undefined reference to `__udivdi3' Avoid the problem by rearranging the offending code to avoid the 64-bit divide operation. Fixes: 28c842c8b0f5 ("clocksource/drivers/timer-tegra186: Add WDIOC_GETTIMELEFT support") Signed-off-by: Guenter Roeck Signed-off-by: Daniel Lezcano Signed-off-by: Ingo Molnar Reviewed-by: Jon Hunter Cc: Pohsun Su Cc: Robert Lin Link: https://lore.kernel.org/r/20250614175556.922159-1-linux@roeck-us.net (cherry picked from commit ed1d4c331f9f161788903885ce9ddfd665bdbe18) Bug 5391604 Change-Id: Ide9d27dc0f09065671713a351265154f8d130559 Signed-off-by: Kartik Rajput Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/canonical/linux-noble/+/3422020 Reviewed-by: Jon Hunter GVS: buildbot_gerritrpt --- drivers/clocksource/timer-tegra186.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-tegra186.c b/drivers/clocksource/timer-tegra186.c index d03e33a759cf..8e6377b419e0 100644 --- a/drivers/clocksource/timer-tegra186.c +++ b/drivers/clocksource/timer-tegra186.c @@ -267,7 +267,7 @@ static unsigned int tegra186_wdt_get_timeleft(struct watchdog_device *wdd) * counter value to the time of the counter expirations that * remain. */ - timeleft += (((u64)wdt->base.timeout * USEC_PER_SEC) / 5) * (4 - expiration); + timeleft += ((u64)wdt->base.timeout * (USEC_PER_SEC / 5)) * (4 - expiration); /* * Convert the current counter value to seconds,