[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DCMJ0VFOV9L1.33BPI08N4H7WZ@kernel.org>
Date: Sun, 07 Sep 2025 13:20:39 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
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 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.
Powered by blists - more mailing lists