[PATCH v4 0/2] rust: add u64 division helpers and fix the pwm_th1520 32-bit build

Andreas Hindborg a.hindborg at kernel.org
Thu Nov 26 03:59:02 PST 2026


FUJITA Tomonori <tomo at flapping.org> writes:

> From: FUJITA Tomonori <fujita.tomonori at gmail.com>
>
> This series fixes the 32-bit build of the TH1520 PWM driver with
> COMPILE_TEST.
>
> Patch 1 adds a math module to the kernel crate with Rust versions of
> div64_u64() and DIV64_U64_ROUND_UP(). Patch 2 uses them in the driver.
>
> The driver only needs u64 by u64 division. It does not need a 128-bit
> intermediate value like mul_u64_u64_div_u64().
>
> Miguel, Uwe acked patch 2 and is fine with this series going through
> the Rust tree.
>
> chenhan's patch [1] also adds rust/kernel/math.rs, with signed
> division helpers. Both use the same module header, so whichever
> is applied later needs only a small rebase.
>
> Tested with the doctests on x86_64 and 32-bit ARM QEMU.
>

Reviewed-by: Andreas Hindborg <a.hindborg at kernel.org>

Best regards,
Andreas Hindborg






More information about the linux-riscv mailing list