[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aL1tloBwmJnYFPpa@google.com>
Date: Sun, 7 Sep 2025 11:33:42 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Benno Lossin <lossin@...nel.org>, 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>, Fiona Behrens <me@...enk.dev>,
Christian Schrefl <chrisi.schrefl@...il.com>, Alban Kurti <kurti@...icto.ai>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: pin-init: add code blocks to `[try_][pin_]init!` macros
On Sun, Sep 07, 2025 at 01:20:39PM +0200, Danilo Krummrich wrote:
> On Sun Sep 7, 2025 at 12:57 PM CEST, Alice Ryhl wrote:
> > On Fri, Sep 05, 2025 at 04:05:31PM +0200, Benno Lossin wrote:
> >> Allow writing `_: { /* any number of statements */ }` in initializers to
> >> run arbitrary code during initialization.
> >>
> >> try_init!(MyStruct {
> >> _: {
> >> if check_something() {
> >> return Err(MyError);
> >> }
> >> },
> >> foo: Foo::new(val),
> >> _: {
> >> println!("successfully initialized `MyStruct`");
> >> },
> >> })
> >>
> >> Link: https://github.com/Rust-for-Linux/pin-init/pull/84/commits/2880a9b898336e2d54f80715f00ce00f21f74d2f
> >> Signed-off-by: Benno Lossin <lossin@...nel.org>
> >
> > Nice! Would it be possible to include a user so I can see it work in
> > practice? E.g., for the irq feature?
>
> Devres needs this too, but the corresponding devres stuff was a fix and is in
> the current -rc only, so that's not a candidate.
>
> The IRQ stuff is in driver-core-next going to Linus for v6.18, hence, using it
> there, this patch would have to go through the driver-core tree as well.
>
> For me it is fine either way.
It doesn't have to land together. I would be happy with:
THIS CYCLE: Land just this patch.
NEXT CYCLE: Land the irq and/or devres user.
But I'd like to see it work in practice before I give a Reviewed-by.
It's hard to evaluate this kind of macro change just from the macro
itself.
Alice
Powered by blists - more mailing lists