[PATCH v2] pwm: th1520: Fix 32-bit build with COMPILE_TEST

FUJITA Tomonori tomo at flapping.org
Wed Sep 30 03:12:57 PDT 2026


From: FUJITA Tomonori <fujita.tomonori at 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.

The TH1520 is a 64-bit RISC-V SoC, so the driver is only used on
64-bit kernels. There is no point in compile testing it on 32-bit.
Limit COMPILE_TEST to 64BIT instead of changing the arithmetic to use
the div64 helpers.

Fixes: 3c180003dffb ("pwm: th1520: Fix missing Kconfig dependencies")
Cc: stable at vger.kernel.org
Reported-by: Andreas Hindborg <a.hindborg at kernel.org>
Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/64bit.20division.20in.20.60pwm_th1520.2Ers.60/near/626825599
Reviewed-by: Andreas Hindborg <a.hindborg at kernel.org>
Reviewed-by: Gary Guo <gary at garyguo.net>
Signed-off-by: FUJITA Tomonori <fujita.tomonori at gmail.com>
---
v2:
- Fix a typo in the commit message
- Add Cc: stable, Reported-by and Closes tags
- Add Reviewed-by tags from Andreas and Gary
- Rebase on v7.3-rc5

v1: https://lore.kernel.org/all/20260929095612.1072417-1-tomo@flapping.org/
---
 drivers/pwm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 729776086879..abecd95b0c3c 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -772,7 +772,7 @@ config PWM_TEGRA
 
 config PWM_TH1520
 	tristate "TH1520 PWM support"
-	depends on ARCH_THEAD || COMPILE_TEST
+	depends on ARCH_THEAD || (COMPILE_TEST && 64BIT)
 	depends on RUST
 	depends on HAS_IOMEM && COMMON_CLK
 	select RUST_PWM_ABSTRACTIONS

base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
-- 
2.43.0




More information about the linux-riscv mailing list