[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <A3285F15-8EE1-45C9-B54F-703C7BC4E161@collabora.com>
Date: Fri, 6 Feb 2026 10:48:27 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Lyude Paul <lyude@...hat.com>
Cc: linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>,
nouveau@...ts.freedesktop.org,
Miguel Ojeda <ojeda@...nel.org>,
Simona Vetter <simona@...ll.ch>,
Alice Ryhl <aliceryhl@...gle.com>,
Shankari Anand <shankari.ak0208@...il.com>,
David Airlie <airlied@...il.com>,
Benno Lossin <lossin@...nel.org>,
Asahi Lina <lina+kernel@...hilina.net>
Subject: Re: [PATCH v5 3/4] rust/drm/gem: Add DriverAllocImpl type alias
> On 30 Jan 2026, at 21:13, Lyude Paul <lyude@...hat.com> wrote:
>
> This is just a type alias that resolves into the AllocImpl for a given
> T: drm::gem::DriverObject
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> rust/kernel/drm/gem/mod.rs | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> index b4199945db378..ad74c5159f725 100644
> --- a/rust/kernel/drm/gem/mod.rs
> +++ b/rust/kernel/drm/gem/mod.rs
> @@ -33,6 +33,11 @@
> /// [`DriverFile`]: drm::file::DriverFile
> pub type DriverFile<T> = drm::File<<<T as DriverObject>::Driver as drm::Driver>::File>;
>
> +/// A type alias for retrieving the current [`AllocImpl`] for a given [`DriverObject`].
> +///
> +/// [`Driver`]: drm::Driver
> +pub type DriverAllocImpl<T> = <<T as DriverObject>::Driver as drm::Driver>::Object;
> +
> /// GEM object functions, which must be implemented by drivers.
> pub trait DriverObject: Sync + Send + Sized {
> /// Parent `Driver` for this object.
> @@ -42,12 +47,12 @@ pub trait DriverObject: Sync + Send + Sized {
> fn new(dev: &drm::Device<Self::Driver>, size: usize) -> impl PinInit<Self, Error>;
>
> /// Open a new handle to an existing object, associated with a File.
> - fn open(_obj: &<Self::Driver as drm::Driver>::Object, _file: &DriverFile<Self>) -> Result {
> + fn open(_obj: &DriverAllocImpl<Self>, _file: &DriverFile<Self>) -> Result {
> Ok(())
> }
>
> /// Close a handle to an existing object, associated with a File.
> - fn close(_obj: &<Self::Driver as drm::Driver>::Object, _file: &DriverFile<Self>) {}
> + fn close(_obj: &DriverAllocImpl<Self>, _file: &DriverFile<Self>) {}
> }
>
> /// Trait that represents a GEM object subtype
> --
> 2.52.0
>
Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
Powered by blists - more mailing lists