From 43a5d04a743b499dbad31083a62cdcb46ee74391 Mon Sep 17 00:00:00 2001 From: Lyude Paul Date: Thu, 7 May 2026 17:59:20 -0400 Subject: [PATCH] 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 Reviewed-by: Daniel Almeida Link: https://patch.msgid.link/20260507220044.3204919-3-lyude@redhat.com Signed-off-by: Danilo Krummrich --- 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 01b5bd47a333..d4b5940ec0df 100644 --- a/rust/kernel/drm/gem/mod.rs +++ b/rust/kernel/drm/gem/mod.rs @@ -73,6 +73,11 @@ unsafe fn dec_ref(obj: core::ptr::NonNull) { /// [`DriverFile`]: drm::file::DriverFile pub type DriverFile = drm::File<<::Driver as drm::Driver>::File>; +/// A type alias for retrieving the current [`AllocImpl`] for a given [`DriverObject`]. +/// +/// [`Driver`]: drm::Driver +pub type DriverAllocImpl = <::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. @@ -89,12 +94,12 @@ fn new( ) -> impl PinInit; /// Open a new handle to an existing object, associated with a File. - fn open(_obj: &::Object, _file: &DriverFile) -> Result { + fn open(_obj: &DriverAllocImpl, _file: &DriverFile) -> Result { Ok(()) } /// Close a handle to an existing object, associated with a File. - fn close(_obj: &::Object, _file: &DriverFile) {} + fn close(_obj: &DriverAllocImpl, _file: &DriverFile) {} } /// Trait that represents a GEM object subtype