[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250122183837.79ad9dcf.gary@garyguo.net>
Date: Wed, 22 Jan 2025 18:38:37 +0000
From: Gary Guo <gary@...yguo.net>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: linux-kernel@...r.kernel.org, Trevor Gross <tmgross@...ch.edu>, Alice
Ryhl <aliceryhl@...gle.com>, rust-for-linux@...r.kernel.org,
netdev@...r.kernel.org, andrew@...n.ch, hkallweit1@...il.com,
ojeda@...nel.org, alex.gaynor@...il.com, bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me, a.hindborg@...sung.com, anna-maria@...utronix.de,
frederic@...nel.org, tglx@...utronix.de, arnd@...db.de, jstultz@...gle.com,
sboyd@...nel.org, mingo@...hat.com, peterz@...radead.org,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, vschneid@...hat.com
Subject: Re: [PATCH v8 1/7] rust: time: Add PartialEq/Eq/PartialOrd/Ord
trait to Ktime
On Thu, 16 Jan 2025 13:40:53 +0900
FUJITA Tomonori <fujita.tomonori@...il.com> wrote:
> Add PartialEq/Eq/PartialOrd/Ord trait to Ktime so two Ktime instances
> can be compared to determine whether a timeout is met or not.
>
> Use the derive implements; we directly touch C's ktime_t rather than
> using the C's accessors because it is more efficient and we already do
> in the existing code (Ktime::sub).
>
> Reviewed-by: Trevor Gross <tmgross@...ch.edu>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
Reviewed-by: Gary Guo <gary@...yguo.net>
> ---
> rust/kernel/time.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/time.rs b/rust/kernel/time.rs
> index 379c0f5772e5..48b71e6641ce 100644
> --- a/rust/kernel/time.rs
> +++ b/rust/kernel/time.rs
> @@ -27,7 +27,7 @@ pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies {
>
> /// A Rust wrapper around a `ktime_t`.
> #[repr(transparent)]
> -#[derive(Copy, Clone)]
> +#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord)]
> pub struct Ktime {
> inner: bindings::ktime_t,
> }
Powered by blists - more mailing lists