diff options
| author | Danilo Krummrich <[email protected]> | 2025-03-06 22:23:27 +0000 |
|---|---|---|
| committer | Danilo Krummrich <[email protected]> | 2025-03-09 18:21:08 +0000 |
| commit | d4245284c8c915107f003a15a20b9abfd40be3ff (patch) | |
| tree | f5d3d3a2ffe82987832f5f260fcb02d00a8734e1 /rust/macros/module.rs | |
| parent | Linux 6.14-rc5 (diff) | |
| download | kernel-d4245284c8c915107f003a15a20b9abfd40be3ff.tar.gz kernel-d4245284c8c915107f003a15a20b9abfd40be3ff.zip | |
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 <[email protected]>
Suggested-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'rust/macros/module.rs')
| -rw-r--r-- | rust/macros/module.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/rust/macros/module.rs b/rust/macros/module.rs index cdf94f4982df..110e59c64197 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}\"); }} |
