[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o6wnkqn1.fsf@kernel.org>
Date: Wed, 23 Apr 2025 14:29:22 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Lyude Paul <lyude@...hat.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, Boqun
Feng <boqun.feng@...il.com>, FUJITA Tomonori <fujita.tomonori@...il.com>,
Frederic Weisbecker <frederic@...nel.org>, Thomas Gleixner
<tglx@...utronix.de>, Anna-Maria Behnsen <anna-maria@...utronix.de>,
John Stultz <jstultz@...gle.com>, Stephen Boyd <sboyd@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Alice Ryhl
<aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo
Krummrich <dakr@...nel.org>
Subject: Re: [PATCH v2 5/8] rust: time: Add Instant::from_nanos()
Lyude Paul <lyude@...hat.com> writes:
> For implementing Rust bindings which can return a point in time.
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> rust/kernel/time.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/rust/kernel/time.rs b/rust/kernel/time.rs
> index 8d6aa88724ad8..545963140f180 100644
> --- a/rust/kernel/time.rs
> +++ b/rust/kernel/time.rs
> @@ -83,6 +83,14 @@ pub fn elapsed(&self) -> Delta {
> pub(crate) fn as_nanos(self) -> i64 {
> self.inner
> }
> +
> + #[expect(unused)]
> + #[inline]
> + pub(crate) fn from_nanos(nanos: i64) -> Self {
Should we `debug_assert!` a positive value here?
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists