[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fd608689-86d2-4fdb-9713-5c69d68808d3@de.bosch.com>
Date: Wed, 29 May 2024 14:00:29 +0200
From: Dirk Behme <dirk.behme@...bosch.com>
To: Danilo Krummrich <dakr@...hat.com>, <gregkh@...uxfoundation.org>,
<rafael@...nel.org>, <bhelgaas@...gle.com>, <ojeda@...nel.org>,
<alex.gaynor@...il.com>, <wedsonaf@...il.com>, <boqun.feng@...il.com>,
<gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <benno.lossin@...ton.me>,
<a.hindborg@...sung.com>, <aliceryhl@...gle.com>, <airlied@...il.com>,
<fujita.tomonori@...il.com>, <lina@...hilina.net>, <pstanner@...hat.com>,
<ajanulgu@...hat.com>, <lyude@...hat.com>
CC: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [RFC PATCH 08/11] rust: add devres abstraction
On 20.05.2024 19:25, Danilo Krummrich wrote:
> Add a Rust abstraction for the kernel's devres (device resource
> management) implementation.
>
> The Devres type acts as a container to manage the lifetime and
> accessibility of device bound resources. Therefore it registers a
> devres callback and revokes access to the resource on invocation.
>
> Users of the Devres abstraction can simply free the corresponding
> resources in their Drop implementation, which is invoked when either the
> Devres instance goes out of scope or the devres callback leads to the
> resource being revoked, which implies a call to drop_in_place().
>
> Co-developed-by: Philipp Stanner <pstanner@...hat.com>
> Signed-off-by: Philipp Stanner <pstanner@...hat.com>
> Signed-off-by: Danilo Krummrich <dakr@...hat.com>
> ---
> rust/helpers.c | 5 ++
> rust/kernel/devres.rs | 151 ++++++++++++++++++++++++++++++++++++++++++
> rust/kernel/lib.rs | 1 +
> 3 files changed, 157 insertions(+)
> create mode 100644 rust/kernel/devres.rs
>
> diff --git a/rust/helpers.c b/rust/helpers.c
> index 1d3e800140fc..34061eca05a0 100644
> --- a/rust/helpers.c
> +++ b/rust/helpers.c
> @@ -173,6 +173,11 @@ void rust_helper_rcu_read_unlock(void)
> EXPORT_SYMBOL_GPL(rust_helper_rcu_read_unlock);
> /* end rcu */
>
> +int rust_helper_devm_add_action(struct device *dev, void (*action)(void *), void *data)
> +{
> + return devm_add_action(dev, action, data);
> +}
> +
> /*
Is it intended to have no EXPORT_SYMBOL_GPL() for
rust_helper_devm_add_action() here?
Best regards
Dirk
Powered by blists - more mailing lists