[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5fLgg9pL0LhaWAMNKig+vnoB97U9zybqjdQieWYB7QdyAwAg@mail.gmail.com>
Date: Wed, 9 Jul 2025 15:36:08 +0200
From: Alice Ryhl <aliceryhl@...gle.com>
To: Daniel Almeida <daniel.almeida@...labora.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, 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>,
Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Bjorn Helgaas <bhelgaas@...gle.com>, Mika Westerberg <mika.westerberg@...ux.intel.com>,
Ying Huang <huang.ying.caritas@...il.com>, Benno Lossin <lossin@...nel.org>,
linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
Fiona Behrens <me@...enk.dev>
Subject: Re: [PATCH v12 1/3] rust: io: add resource abstraction
On Tue, Jul 8, 2025 at 7:44 PM Daniel Almeida
<daniel.almeida@...labora.com> wrote:
>
> Hi Alice,
>
> […]
>
>
> >> +
> >> +impl Resource {
> >> + /// Creates a reference to a [`Resource`] from a valid pointer.
> >> + ///
> >> + /// # Safety
> >> + ///
> >> + /// The caller must ensure that for the duration of 'a, the pointer will
> >> + /// point at a valid `bindings::resource`.
> >> + ///
> >> + /// The caller must also ensure that the [`Resource`] is only accessed via the
> >> + /// returned reference for the duration of 'a.
> >> + pub(crate) const unsafe fn as_ref<'a>(ptr: *mut bindings::resource) -> &'a Self {
> >
> > We usually call this method `from_raw`.
>
> Hmm, pretty sure I have seen the exact opposite being asked. In fact, this was
> discussed a bit at length a while ago. See the thread starting at [0] for context.
I will submit a patch.
Alicej
Powered by blists - more mailing lists