From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: FUJITA Tomonori <tomo@flapping.org>,
Michal Wilczynski <m.wilczynski@samsung.com>
Cc: fustini@kernel.org, guoren@kernel.org, ojeda@kernel.org,
wefu@redhat.com, a.hindborg@kernel.org, acourbot@nvidia.com,
aliceryhl@google.com, bjorn3_gh@protonmail.com,
boqun@kernel.org, chenhan0017.work@gmail.com, dakr@kernel.org,
daniel.almeida@collabora.com, gary@garyguo.net,
linux-riscv@lists.infradead.org, lossin@kernel.org,
tamird@kernel.org, tmgross@umich.edu, work@onurozkan.dev,
linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org,
FUJITA Tomonori <fujita.tomonori@gmail.com>
Subject: Re: [PATCH v3 2/2] pwm: th1520: Fix 32-bit build with COMPILE_TEST
Date: Mon, 16 Nov 2026 15:57:46 +0100 [thread overview]
Message-ID: <avsZPKgzc9DIIsh8@monoceros> (raw)
In-Reply-To: <20261030020209.3833766-3-tomo@flapping.org>
[-- Attachment #1: Type: text/plain, Size: 2540 bytes --]
Hello,
On Fri, Oct 30, 2026 at 11:02:09AM +0900, FUJITA Tomonori wrote:
> From: FUJITA Tomonori <fujita.tomonori@gmail.com>
>
> Fix the following build error on 32-bit ARM with COMPILE_TEST:
>
> ERROR: modpost: drivers/pwm/pwm_th1520.ko: symbol '__aeabi_uldivmod' undefined!
>
> The driver divides u64 values when it converts between nanoseconds and
> clock cycles. On 32-bit ARM, these divisions are compiled to calls to
> __aeabi_uldivmod, which the kernel does not provide.
>
> Use div64_u64() and div64_u64_round_up() for these divisions, in the
> same way as C drivers use div64_u64() and DIV64_U64_ROUND_UP(). The
> results do not change.
>
> Fixes: 3c180003dffb ("pwm: th1520: Fix missing Kconfig dependencies")
> Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/64bit.20division.20in.20.60pwm_th1520.2Ers.60/near/626825599
> Suggested-by: Uwe Kleine-König <ukleinek@kernel.org>
> Assisted-by: LLM
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> ---
> drivers/pwm/pwm_th1520.rs | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> index 728993998446..bd05fe49650e 100644
> --- a/drivers/pwm/pwm_th1520.rs
> +++ b/drivers/pwm/pwm_th1520.rs
> @@ -31,6 +31,10 @@
> mem::DevresIoMem,
> Io, //
> },
> + math::{
> + div64_u64,
> + div64_u64_round_up, //
> + },
> of,
> platform,
> prelude::*,
> @@ -68,13 +72,13 @@ const fn th1520_pwm_fp(n: u32) -> usize {
> fn ns_to_cycles(ns: u64, rate_hz: u64) -> u64 {
> const NSEC_PER_SEC_U64: u64 = time::NSEC_PER_SEC as u64;
>
> - ns.saturating_mul(rate_hz) / NSEC_PER_SEC_U64
> + div64_u64(ns.saturating_mul(rate_hz), NSEC_PER_SEC_U64)
> }
>
> fn cycles_to_ns(cycles: u32, rate_hz: u64) -> u64 {
> const NSEC_PER_SEC_U64: u64 = time::NSEC_PER_SEC as u64;
>
> - (u64::from(cycles) * NSEC_PER_SEC_U64).div_ceil(rate_hz)
> + div64_u64_round_up(u64::from(cycles) * NSEC_PER_SEC_U64, rate_hz)
> }
>
> /// Hardware-specific waveform representation for TH1520.
For me (being at most half-literate in Rust) it looks ok, and I'm fine
to let this patch go in together with the first patch of this series via
the Rust tree.
@Michal: If you have objections speak up quick!
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: FUJITA Tomonori <tomo@flapping.org>,
Michal Wilczynski <m.wilczynski@samsung.com>
Cc: fustini@kernel.org, guoren@kernel.org, ojeda@kernel.org,
wefu@redhat.com, a.hindborg@kernel.org, acourbot@nvidia.com,
aliceryhl@google.com, bjorn3_gh@protonmail.com,
boqun@kernel.org, chenhan0017.work@gmail.com, dakr@kernel.org,
daniel.almeida@collabora.com, gary@garyguo.net,
linux-riscv@lists.infradead.org, lossin@kernel.org,
tamird@kernel.org, tmgross@umich.edu, work@onurozkan.dev,
linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org,
FUJITA Tomonori <fujita.tomonori@gmail.com>
Subject: Re: [PATCH v3 2/2] pwm: th1520: Fix 32-bit build with COMPILE_TEST
Date: Mon, 16 Nov 2026 15:57:46 +0100 [thread overview]
Message-ID: <avsZPKgzc9DIIsh8@monoceros> (raw)
In-Reply-To: <20261030020209.3833766-3-tomo@flapping.org>
[-- Attachment #1.1: Type: text/plain, Size: 2540 bytes --]
Hello,
On Fri, Oct 30, 2026 at 11:02:09AM +0900, FUJITA Tomonori wrote:
> From: FUJITA Tomonori <fujita.tomonori@gmail.com>
>
> Fix the following build error on 32-bit ARM with COMPILE_TEST:
>
> ERROR: modpost: drivers/pwm/pwm_th1520.ko: symbol '__aeabi_uldivmod' undefined!
>
> The driver divides u64 values when it converts between nanoseconds and
> clock cycles. On 32-bit ARM, these divisions are compiled to calls to
> __aeabi_uldivmod, which the kernel does not provide.
>
> Use div64_u64() and div64_u64_round_up() for these divisions, in the
> same way as C drivers use div64_u64() and DIV64_U64_ROUND_UP(). The
> results do not change.
>
> Fixes: 3c180003dffb ("pwm: th1520: Fix missing Kconfig dependencies")
> Reported-by: Andreas Hindborg <a.hindborg@kernel.org>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/64bit.20division.20in.20.60pwm_th1520.2Ers.60/near/626825599
> Suggested-by: Uwe Kleine-König <ukleinek@kernel.org>
> Assisted-by: LLM
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
> ---
> drivers/pwm/pwm_th1520.rs | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> index 728993998446..bd05fe49650e 100644
> --- a/drivers/pwm/pwm_th1520.rs
> +++ b/drivers/pwm/pwm_th1520.rs
> @@ -31,6 +31,10 @@
> mem::DevresIoMem,
> Io, //
> },
> + math::{
> + div64_u64,
> + div64_u64_round_up, //
> + },
> of,
> platform,
> prelude::*,
> @@ -68,13 +72,13 @@ const fn th1520_pwm_fp(n: u32) -> usize {
> fn ns_to_cycles(ns: u64, rate_hz: u64) -> u64 {
> const NSEC_PER_SEC_U64: u64 = time::NSEC_PER_SEC as u64;
>
> - ns.saturating_mul(rate_hz) / NSEC_PER_SEC_U64
> + div64_u64(ns.saturating_mul(rate_hz), NSEC_PER_SEC_U64)
> }
>
> fn cycles_to_ns(cycles: u32, rate_hz: u64) -> u64 {
> const NSEC_PER_SEC_U64: u64 = time::NSEC_PER_SEC as u64;
>
> - (u64::from(cycles) * NSEC_PER_SEC_U64).div_ceil(rate_hz)
> + div64_u64_round_up(u64::from(cycles) * NSEC_PER_SEC_U64, rate_hz)
> }
>
> /// Hardware-specific waveform representation for TH1520.
For me (being at most half-literate in Rust) it looks ok, and I'm fine
to let this patch go in together with the first patch of this series via
the Rust tree.
@Michal: If you have objections speak up quick!
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Best regards
Uwe
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-11-16 14:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 2:02 [PATCH v3 0/2] pwm: th1520: Fix 32-bit build with COMPILE_TEST FUJITA Tomonori
2026-10-30 2:02 ` FUJITA Tomonori
2026-10-30 2:02 ` [PATCH v3 1/2] rust: math: add div64_u64() and div64_u64_round_up() FUJITA Tomonori
2026-10-30 2:02 ` FUJITA Tomonori
2026-10-30 2:02 ` [PATCH v3 2/2] pwm: th1520: Fix 32-bit build with COMPILE_TEST FUJITA Tomonori
2026-10-30 2:02 ` FUJITA Tomonori
2026-11-16 14:57 ` Uwe Kleine-König [this message]
2026-11-16 14:57 ` Uwe Kleine-König
2026-10-31 10:37 ` [PATCH v3 0/2] " chenhan
2026-10-31 10:37 ` chenhan
2026-11-14 13:46 ` FUJITA Tomonori
2026-11-14 13:46 ` FUJITA Tomonori
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=avsZPKgzc9DIIsh8@monoceros \
--to=ukleinek@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=chenhan0017.work@gmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=fujita.tomonori@gmail.com \
--cc=fustini@kernel.org \
--cc=gary@garyguo.net \
--cc=guoren@kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lossin@kernel.org \
--cc=m.wilczynski@samsung.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=tomo@flapping.org \
--cc=wefu@redhat.com \
--cc=work@onurozkan.dev \
/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.