[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DDO6PXJKZGOU.9AWQMAML1K7J@kernel.org>
Date: Tue, 21 Oct 2025 19:43:27 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Benno Lossin" <lossin@...nel.org>
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>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Fiona Behrens" <me@...enk.dev>, "Christian Schrefl"
<chrisi.schrefl@...il.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] add `[pin_]init_scope` to execute code before creating
an initializer
On Thu Oct 16, 2025 at 11:05 PM CEST, Benno Lossin wrote:
> In more complex cases, initializers need to run arbitrary code before
> assigning initializers to fields. While this is possible using the
> underscore codeblock feature (`_: {}`), values returned by such
> functions cannot be used from later field initializers.
>
> The two new functinos `[pin_]init_scope` allow users to first run some
> fallible code and then return an initializer which the function turns
> into a single initializer. This permits using the same value multiple
> times by different fields.
>
> Reviewed-by: Gary Guo <gary@...yguo.net>
> Reviewed-by: Danilo Krummrich <dakr@...nel.org>
> Signed-off-by: Benno Lossin <lossin@...nel.org>
Applied to driver-core-testing, thanks!
[ Fix typo in commit message: s/functinos/functions/. - Danilo ]
Benno, thanks a lot for providing this patch as prerequisite for [1]; your quick
support with pin-init whenever something comes up is much appreciated!
[1] https://lore.kernel.org/all/20251016125544.15559-1-dakr@kernel.org/
Powered by blists - more mailing lists