[PATCH 3/8] rust: drm: add `ThisModule` associated type to `Driver` trait
From: Alvin Sun
Date: Tue May 19 2026 - 02:35:39 EST
Add a `ThisModule` associated type bound by `ModuleMetadata` to the
`drm::Driver` trait, allowing DRM drivers to expose their module
pointer for use in file operations.
Signed-off-by: Alvin Sun <alvin.sun@xxxxxxxxx>
---
rust/kernel/drm/driver.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/rust/kernel/drm/driver.rs b/rust/kernel/drm/driver.rs
index 5233bdebc9fcd..c798961650c1a 100644
--- a/rust/kernel/drm/driver.rs
+++ b/rust/kernel/drm/driver.rs
@@ -115,6 +115,9 @@ pub trait Driver {
/// IOCTL list. See `kernel::drm::ioctl::declare_drm_ioctls!{}`.
const IOCTLS: &'static [drm::ioctl::DrmIoctlDescriptor];
+
+ /// The module implementing this driver.
+ type ThisModule: crate::ModuleMetadata;
}
/// The registration type of a `drm::Device`.
--
2.43.0