From: Lyude Paul Date: Thu, 7 May 2026 21:59:20 +0000 (-0400) Subject: rust/drm/gem: Add DriverAllocImpl type alias X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43a5d04a743b499dbad31083a62cdcb46ee74391;p=thirdparty%2Flinux.git 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 --- diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs index 01b5bd47a3332..d4b5940ec0df2 100644 --- a/rust/kernel/drm/gem/mod.rs +++ b/rust/kernel/drm/gem/mod.rs @@ -73,6 +73,11 @@ pub(crate) use impl_aref_for_gem_obj; /// [`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 @@ pub trait DriverObject: Sync + Send + Sized { ) -> 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