[PATCH v2 2/7] pwm: Add Rust driver for T-HEAD TH1520 SoC
Michal Wilczynski
m.wilczynski at samsung.com
Wed Jun 11 14:15:57 PDT 2025
On 6/11/25 22:04, Michal Wilczynski wrote:
>
>
> On 6/11/25 08:58, Uwe Kleine-König wrote:
>> Hello,
>>
>>
>> What does .unwrap_or(0) do? You need to round up in this mul_div
>> operation.
Yeah and I'm thinking that the helper needs to be updated or new one
added like mul_div_round_up, to do the rounding
>
> The .unwrap_or(0) is to handle the case where the mul_div helper returns
> None, which can happen if the divisor (rate_hz) is zero. In that case,
> the period becomes 0. The mul_div helper is introduced in this commit
> [1].
>
> [1] - https://lore.kernel.org/all/20250609-math-rust-v1-v1-1-285fac00031f@samsung.com/
>
Best regards,
--
Michal Wilczynski <m.wilczynski at samsung.com>
More information about the linux-riscv
mailing list