[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEr-OnKiL5MKzur2@cassiopeiae>
Date: Thu, 12 Jun 2025 18:20:10 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Benno Lossin <lossin@...nel.org>
Cc: gregkh@...uxfoundation.org, rafael@...nel.org, ojeda@...nel.org,
alex.gaynor@...il.com, boqun.feng@...il.com, gary@...yguo.net,
bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] rust: revocable: support fallible PinInit types
On Thu, Jun 12, 2025 at 06:17:40PM +0200, Benno Lossin wrote:
> On Thu Jun 12, 2025 at 5:58 PM CEST, Danilo Krummrich wrote:
> > On Thu, Jun 12, 2025 at 05:48:36PM +0200, Benno Lossin wrote:
> >> On Thu Jun 12, 2025 at 4:51 PM CEST, Danilo Krummrich wrote:
> >> > diff --git a/rust/kernel/revocable.rs b/rust/kernel/revocable.rs
> >> > index fa1fd70efa27..41b8fe374af6 100644
> >> > --- a/rust/kernel/revocable.rs
> >> > +++ b/rust/kernel/revocable.rs
> >> > @@ -82,8 +82,11 @@ unsafe impl<T: Sync + Send> Sync for Revocable<T> {}
> >> >
> >> > impl<T> Revocable<T> {
> >> > /// Creates a new revocable instance of the given data.
> >> > - pub fn new(data: impl PinInit<T>) -> impl PinInit<Self> {
> >> > - pin_init!(Self {
> >> > + pub fn new<E>(data: impl PinInit<T, E>) -> impl PinInit<Self, Error>
> >> > + where
> >> > + Error: From<E>,
> >>
> >> I don't think we need this bound as you don't use it in the function
> >> body.
> >
> > I think it's needed by try_pin_init!() below, no?
> >
> > Without it I get the compilation error in [1].
> >
> >> > + {
> >> > + try_pin_init!(Self {
> >> > is_available: AtomicBool::new(true),
> >> > data <- Opaque::pin_init(data),
> >> > })
>
> Does it work with this?
>
> try_pin_init!(Self {
> is_available: AtomicBool::new(true),
> data <- Opaque::pin_init(data),
> }? E)
Yes, it does -- thanks!
Powered by blists - more mailing lists