[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260131001602.2095470-4-lyude@redhat.com>
Date: Fri, 30 Jan 2026 19:13:32 -0500
From: Lyude Paul <lyude@...hat.com>
To: linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>
Cc: 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>,
"Daniel Almeida" <daniel.almeida@...labora.com>,
"Lyude Paul" <lyude@...hat.com>
Subject: [PATCH v5 3/4] rust/drm/gem: Add DriverAllocImpl type alias
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
Powered by blists - more mailing lists