rust: time: Add HrTimerExpires trait
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Tue, 10 Jun 2025 13:28:21 +0000 (22:28 +0900)
committerAndreas Hindborg <a.hindborg@kernel.org>
Tue, 24 Jun 2025 17:52:47 +0000 (19:52 +0200)
commitd9fc00dc73542eef98db74085447c57174ca290d
tree5b3c3f06c0c96698d02a6f6759148a502afec7f0
parentced9ccd21fbc8ca941e6a0c2820c2df89239ccb9
rust: time: Add HrTimerExpires trait

Introduce the `HrTimerExpires` trait to represent types that can be
used as expiration values for high-resolution timers. Define a
required method, `into_nanos()`, which returns the expiration time as a
raw nanosecond value suitable for use with C's hrtimer APIs.

Also extend the `HrTimerMode` to use the `HrTimerExpires` trait.

This refactoring is a preparation for enabling hrtimer code to work
uniformly with both absolute and relative expiration modes.

Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Link: https://lore.kernel.org/r/20250610132823.3457263-4-fujita.tomonori@gmail.com
[ changed conversion method names to `as_*` - Andreas ]
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
rust/kernel/time.rs
rust/kernel/time/hrtimer.rs