[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v7wzoliv.ffs@tglx>
Date: Thu, 07 Nov 2024 02:55:20 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Andreas Hindborg <a.hindborg@...nel.org>, Miguel Ojeda
<ojeda@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>
Cc: Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...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>, Lyude Paul <lyude@...hat.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org, Andreas
Hindborg <a.hindborg@...nel.org>
Subject: Re: [PATCH v3 02/13] rust: hrtimer: introduce hrtimer support
Andreas!
On Thu, Oct 17 2024 at 15:04, Andreas Hindborg wrote:
> +impl<T> Timer<T> {
> + /// Return an initializer for a new timer instance.
> + pub fn new() -> impl PinInit<Self>
> + where
> + T: TimerCallback,
> + {
> + pin_init!(Self {
> + // INVARIANTS: We initialize `timer` with `hrtimer_init` below.
> + timer <- Opaque::ffi_init(move |place: *mut bindings::hrtimer| {
> + // SAFETY: By design of `pin_init!`, `place` is a pointer live
> + // allocation. hrtimer_init will initialize `place` and does not
> + // require `place` to be initialized prior to the call.
> + unsafe {
> + bindings::hrtimer_init(
> + place,
> + bindings::CLOCK_MONOTONIC as i32,
> + bindings::hrtimer_mode_HRTIMER_MODE_REL,
> + );
> + }
> +
> + // SAFETY: `place` is pointing to a live allocation, so the deref
> + // is safe.
> + let function =
> + unsafe { core::ptr::addr_of_mut!((*place).function) };
I assume you are sending a new version of this series due to the
reported build issue.
If so, can you please rebase against
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
It contains the new hrtimer_setup() function, which initializes the
timer including the callback function pointer.
Thanks,
tglx
Powered by blists - more mailing lists