Re: [PATCH v2] pwm: th1520: Remove requirement for mul_u64_u64_div_u64_roundup
From: Uwe Kleine-König
Date: Fri Jun 05 2026 - 08:13:03 EST
Hello,
On Fri, Jun 05, 2026 at 09:03:59AM +0200, Maurice Hieronymus wrote:
> The cycle register is always u32, so cycles_to_ns() can take a u32
> instead of a u64. With that narrowing, cycles * NSEC_PER_SEC is at most
> u32::MAX * 1e9 (~4.3e18), which fits in u64 without overflow. The
> saturating arithmetic is therefore no longer needed, and the ceiling
> division can use Rust's u64::div_ceil() directly instead of the
> open-coded numerator/denominator form.
>
> This also drops the TODO referring to a future
> mul_u64_u64_div_u64_roundup kernel helper, which is no longer required.
>
> Reviewed-by: Michal Wilczynski <m.wilczynski@xxxxxxxxxxx>
> Signed-off-by: Maurice Hieronymus <mhi@xxxxxxxxxxx>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
Thanks
Uwe
Attachment:
signature.asc
Description: PGP signature