From: Danilo Krummrich Date: Thu, 6 Mar 2025 22:23:27 +0000 (+0100) Subject: rust: module: add type `LocalModule` X-Git-Tag: v6.15-rc1~120^2~7^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4245284c8c915107f003a15a20b9abfd40be3ff;p=thirdparty%2Flinux.git rust: module: add type `LocalModule` The `LocalModule` type is the type of the module created by `module!`, `module_pci_driver!`, `module_platform_driver!`, etc. Since the exact type of the module is sometimes generated on the fly by the listed macros, provide an alias. This is first used by the `module_firmware!` macro. Acked-by: Miguel Ojeda Suggested-by: Alice Ryhl Link: https://lore.kernel.org/r/20250306222336.23482-2-dakr@kernel.org Signed-off-by: Danilo Krummrich --- diff --git a/rust/macros/module.rs b/rust/macros/module.rs index cdf94f4982dfc..110e59c64197d 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -228,6 +228,10 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { kernel::ThisModule::from_ptr(core::ptr::null_mut()) }}; + /// The `LocalModule` type is the type of the module created by `module!`, + /// `module_pci_driver!`, `module_platform_driver!`, etc. + type LocalModule = {type_}; + impl kernel::ModuleMetadata for {type_} {{ const NAME: &'static kernel::str::CStr = kernel::c_str!(\"{name}\"); }}