[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87jz3f70bq.fsf@kernel.org>
Date: Thu, 07 Aug 2025 15:01:13 +0200
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Daniel Almeida <daniel.almeida@...labora.com>, Lyude Paul
<lyude@...hat.com>
Cc: rust-for-linux@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org, FUJITA
Tomonori <fujita.tomonori@...il.com>, Frederic Weisbecker
<frederic@...nel.org>, 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 <lossin@...nel.org>, Alice
Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo
Krummrich <dakr@...nel.org>
Subject: Re: [PATCH v6 3/7] rust: hrtimer: Add HrTimer::raw_forward() and
forward()
"Daniel Almeida" <daniel.almeida@...labora.com> writes:
> […]
>
>
>> +
>> + /// Conditionally forward the timer.
>> + ///
>> + /// If the timer expires after `now`, this function does nothing and returns 0. If the timer
>> + /// expired at or before `now`, this function forwards the timer by `interval` until the timer
>> + /// expires after `now` and then returns the number of times the timer was forwarded by
>> + /// `interval`.
>> + ///
>> + /// Returns the number of overruns that occurred as a result of the timer expiry change.
>> + pub fn forward(self: Pin<&mut Self>, now: HrTimerInstant<T>, interval: Delta) -> u64
>> + where
>> + T: HasHrTimer<T>,
>> + {
>> + // SAFETY:
>> + // - `raw_forward` does not move `self`.
>> + // - Self is a mutable reference and thus always points to a valid `HrTimer`
>
> I get what you're trying to say, but IMHO using the word "mutable" here is
> confusing. Mutability has nothing to do on whether something is valid. This
> should be rephrased, IMHO.
Having a reference to something implies validity. We could do:
The coertion of `&mut Self` to `*mut Self` results in a pointer to a
valid `Self`.
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists