[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DA9QVI519FK6.1VZGKW6HN7IDH@kernel.org>
Date: Fri, 30 May 2025 21:33:11 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>, <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>, <chrisi.schrefl@...il.com>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/7] rust: devres: support fallible in-place init for
data
On Fri May 30, 2025 at 4:24 PM CEST, Danilo Krummrich wrote:
> Currently, Devres only supports a data argument of type T. However,
> DevresInner already uses pin-init to initialize the Revocable. Hence,
> there is no need for this limitation and we can take a data argument of
> type impl PinInit<T, E> instead.
Missing '`'.
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
Reviewed-by: Benno Lossin <lossin@...nel.org>
> ---
> rust/kernel/devres.rs | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
> index 2dbe17d6ea1f..47aeb5196dd2 100644
> --- a/rust/kernel/devres.rs
> +++ b/rust/kernel/devres.rs
> @@ -96,9 +96,16 @@ struct DevresInner<T> {
> pub struct Devres<T>(Arc<DevresInner<T>>);
>
> impl<T> DevresInner<T> {
> - fn new(dev: &Device<Bound>, data: T, flags: Flags) -> Result<Arc<DevresInner<T>>> {
> - let inner = Arc::pin_init(
> - try_pin_init!( DevresInner {
> + fn new<E>(
> + dev: &Device<Bound>,
> + data: impl PinInit<T, E>,
> + flags: Flags,
> + ) -> Result<Arc<DevresInner<T>>>
> + where
> + Error: From<E>,
> + {
> + let inner = Arc::pin_init::<Error>(
> + try_pin_init!( Self {
Spurious space between `!(` and `Self {`.
---
Cheers,
Benno
Powered by blists - more mailing lists