[PATCH v2] pwm: th1520: Remove requirement for mul_u64_u64_div_u64_roundup

Uwe Kleine-König ukleinek at kernel.org
Fri Jun 5 05:07:58 PDT 2026


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 at samsung.com>
> Signed-off-by: Maurice Hieronymus <mhi at mailbox.org>

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next

Thanks
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/20260605/4413be9f/attachment.sig>


More information about the linux-riscv mailing list