All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	Pohsun Su <pohsuns@nvidia.com>, Robert Lin <robelin@nvidia.com>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 1/2] clocksource/drivers/timer-tegra186: Avoid 64-bit divide operation
Date: Tue, 24 Jun 2025 16:32:20 +0200	[thread overview]
Message-ID: <aFq29Fr5c2TAZOYO@mai.linaro.org> (raw)
In-Reply-To: <20250614175556.922159-1-linux@roeck-us.net>

On Sat, Jun 14, 2025 at 10:55:55AM -0700, Guenter Roeck wrote:
> 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.
> 

Hi Guenter,

Arnd posted a version which seems more complete.

https://lore.kernel.org/all/20250620111939.3395525-1-arnd@kernel.org/

> Fixes: 28c842c8b0f5 ("clocksource/drivers/timer-tegra186: Add WDIOC_GETTIMELEFT support")
> Cc: Pohsun Su <pohsuns@nvidia.com>
> Cc: Robert Lin <robelin@nvidia.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  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 e5394f98a02e..7b506de65438 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,
> -- 
> 2.45.2
> 

-- 

 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  parent reply	other threads:[~2025-06-24 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-14 17:55 [PATCH 1/2] clocksource/drivers/timer-tegra186: Avoid 64-bit divide operation Guenter Roeck
2025-06-14 17:55 ` [PATCH 2/2] clocksource/drivers/timer-tegra186: Simplify calculating timeleft Guenter Roeck
2025-06-19  7:25   ` Jon Hunter
2025-07-23  7:17   ` [tip: timers/clocksource] " tip-bot2 for Guenter Roeck
2025-07-25 10:31   ` tip-bot2 for Guenter Roeck
2025-06-19  7:17 ` [PATCH 1/2] clocksource/drivers/timer-tegra186: Avoid 64-bit divide operation Jon Hunter
2025-06-24 14:32 ` Daniel Lezcano [this message]
2025-07-03 12:34   ` Jon Hunter
2025-07-03 12:42     ` Daniel Lezcano
2025-07-15 11:11 ` Daniel Lezcano
2025-07-23  7:17 ` [tip: timers/clocksource] " tip-bot2 for Guenter Roeck
2025-07-25 10:31 ` tip-bot2 for Guenter Roeck

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=aFq29Fr5c2TAZOYO@mai.linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=arnd@arndb.de \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pohsuns@nvidia.com \
    --cc=robelin@nvidia.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@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.