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

Uwe Kleine-König ukleinek at kernel.org
Wed Sep 30 23:27:45 PDT 2026


Hello,

On Thu, Oct 01, 2026 at 07:02:15AM +0900, FUJITA Tomonori wrote:
> On Wed, 30 Sep 2026 13:57:31 +0200
> Uwe Kleine-König <ukleinek at kernel.org> wrote:
> 
> >> 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
> > 
> > Can't we do better than that? For C code the right thing to do is to use
> > one of the div helpers instead of a plain / for types bigger than long.
> 
> Indeed. Rust code already uses some div helpers. However, the kernel
> crate does not have Rust wrappers for the helpers this driver needs,
> such as mul_u64_u64_div_u64(), so we need to add them first. The
> changes would be too large for stable.
> 
> So how about merging this as a fix? I will work on patches to use div
> helpers in the driver.

Fine, then let me just wonder about the expression you chose, that makes
it look as if 64BIT was only needed for COMPILE_TEST.

How about making this

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 729776086879..4cc2911a0673 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -774,6 +774,7 @@ config PWM_TH1520
 	tristate "TH1520 PWM support"
 	depends on ARCH_THEAD || COMPILE_TEST
 	depends on RUST
+	depends on 64BIT # no 64bit division available on 32 bit builds
 	depends on HAS_IOMEM && COMMON_CLK
 	select RUST_PWM_ABSTRACTIONS
 	help

instead?

Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20261001/7b62b4cd/attachment.sig>


More information about the linux-riscv mailing list