Re: [PATCH v1] rust: time: Avoid 64-bit integer division

From: Andreas Hindborg
Date: Mon May 05 2025 - 08:18:55 EST


"FUJITA Tomonori" <fujita.tomonori@xxxxxxxxx> writes:

> On Mon, 05 May 2025 12:46:15 +0200
> Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:
>
>> FUJITA Tomonori <fujita.tomonori@xxxxxxxxx> writes:
>>
>>> Avoid 64-bit integer division that 32-bit architectures don't
>>> implement generally. This uses ktime_to_ms() and ktime_to_us()
>>> instead.
>>>
>>> The timer abstraction needs i64 / u32 division so C's div_s64() can be
>>> used but ktime_to_ms() and ktime_to_us() provide a simpler solution
>>> for this timer abstraction problem. On some architectures, there is
>>> room to optimize the implementation of them, but such optimization can
>>> be done if and when it becomes necessary.
>>>
>>> One downside of calling the C's functions is that the as_micros/millis
>>> methods can no longer be const fn. We stick with the simpler approach
>>> unless there's a compelling need for a const fn.
>>>
>>> Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxx>
>>
>>
>> Please consult recent MAINTAINERS file when you send patches. If you
>> intend for me to see a patch, please use my registered email address.
>
> Sorry, I did follow that for the last two patchsets (generalizing
> Instant and hrtimer), but somehow I messed up with this one.
>
> Should I resend v2 of this fix to the correct email address?
>
> https://lore.kernel.org/lkml/20250502004524.230553-1-fujita.tomonori@xxxxxxxxx/

No I got it from list, so it's fine for this one. But please stop CC'ing
the the Samsung address.


Best regards,
Andreas Hindborg