Skip to content

Commit d424528

Browse files
author
Danilo Krummrich
committed
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 <ojeda@kernel.org> Suggested-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20250306222336.23482-2-dakr@kernel.org Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 7eb1721 commit d424528

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rust/macros/module.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
228228
kernel::ThisModule::from_ptr(core::ptr::null_mut())
229229
}};
230230
231+
/// The `LocalModule` type is the type of the module created by `module!`,
232+
/// `module_pci_driver!`, `module_platform_driver!`, etc.
233+
type LocalModule = {type_};
234+
231235
impl kernel::ModuleMetadata for {type_} {{
232236
const NAME: &'static kernel::str::CStr = kernel::c_str!(\"{name}\");
233237
}}

0 commit comments

Comments
 (0)