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

FUJITA Tomonori tomo at flapping.org
Thu Oct 1 02:07:22 PDT 2026


On Thu, 1 Oct 2026 08:27:45 +0200
Uwe Kleine-König <ukleinek at kernel.org> wrote:

>> > 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?

Yeah, it's cleaner.




More information about the linux-riscv mailing list