Skip to content

Commit 0e2aab6

Browse files
LyudeAndreas Hindborg
authored andcommitted
rust: hrtimer: Add HrTimerInstant
Since we want to add HrTimer methods that can accept Instants, we will want to make sure that for each method we are using the correct Clocksource for the given HrTimer. This would get a bit overly-verbose, so add a simple HrTimerInstant type-alias to handle this for us. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://lore.kernel.org/r/20250821193259.964504-3-lyude@redhat.com Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
1 parent a984da2 commit 0e2aab6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

rust/kernel/time/hrtimer.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ use crate::{prelude::*, types::Opaque};
7272
use core::marker::PhantomData;
7373
use pin_init::PinInit;
7474

75+
/// A type-alias to refer to the [`Instant<C>`] for a given `T` from [`HrTimer<T>`].
76+
///
77+
/// Where `C` is the [`ClockSource`] of the [`HrTimer`].
78+
pub type HrTimerInstant<T> = Instant<<<T as HasHrTimer<T>>::TimerMode as HrTimerMode>::Clock>;
79+
7580
/// A timer backed by a C `struct hrtimer`.
7681
///
7782
/// # Invariants

0 commit comments

Comments
 (0)