[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b983c624-399e-406c-9964-560ed5323d27@gmail.com>
Date: Sun, 13 Apr 2025 21:38:19 +0200
From: Christian Schrefl <chrisi.schrefl@...il.com>
To: Danilo Krummrich <dakr@...nel.org>, bhelgaas@...gle.com,
kwilczynski@...nel.org, gregkh@...uxfoundation.org, rafael@...nel.org,
abdiel.janulgue@...il.com
Cc: 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,
daniel.almeida@...labora.com, robin.murphy@....com,
linux-pci@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/9] rust: device: implement impl_device_context_deref!
On 13.04.25 7:36 PM, Danilo Krummrich wrote:
> The Deref hierarchy for device context generics is the same for every
> (bus specific) device.
>
> Implement those with a generic macro to avoid duplicated boiler plate
> code and ensure the correct Deref hierarchy for every device
> implementation.
>
> Co-developed-by: Benno Lossin <benno.lossin@...ton.me>
> Signed-off-by: Benno Lossin <benno.lossin@...ton.me>
> Signed-off-by: Danilo Krummrich <dakr@...nel.org>
> ---
> rust/kernel/device.rs | 44 +++++++++++++++++++++++++++++++++++++++++
> rust/kernel/pci.rs | 16 +++------------
> rust/kernel/platform.rs | 17 +++-------------
> 3 files changed, 50 insertions(+), 27 deletions(-)
>
> diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
> index 21b343a1dc4d..7cb6f0fc005d 100644
> --- a/rust/kernel/device.rs
> +++ b/rust/kernel/device.rs
> @@ -235,6 +235,50 @@ impl Sealed for super::Normal {}
> impl DeviceContext for Core {}
> impl DeviceContext for Normal {}
>
> +/// # Safety
> +///
> +/// The type given as `$device` must be a transparent wrapper of a type that doesn't depend on the
> +/// generic argument of `$device`.
Maybe explicitly mention that the memory layout/representation
therefore doesn't depend on the generic arguments.
Either way:
Reviewed-by: Christian Schrefl <chrisi.schrefl@...il.com>
Cheers
Christian
Powered by blists - more mailing lists