[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250306222336.23482-2-dakr@kernel.org>
Date: Thu, 6 Mar 2025 23:23:27 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: airlied@...il.com,
simona@...ll.ch,
corbet@....net,
maarten.lankhorst@...ux.intel.com,
mripard@...nel.org,
tzimmermann@...e.de,
ajanulgu@...hat.com,
lyude@...hat.com,
pstanner@...hat.com,
zhiw@...dia.com,
cjia@...dia.com,
jhubbard@...dia.com,
bskeggs@...dia.com,
acurrid@...dia.com
Cc: ojeda@...nel.org,
alex.gaynor@...il.com,
boqun.feng@...il.com,
gary@...yguo.net,
bjorn3_gh@...tonmail.com,
benno.lossin@...ton.me,
a.hindborg@...nel.org,
aliceryhl@...gle.com,
tmgross@...ch.edu,
gregkh@...uxfoundation.org,
mcgrof@...nel.org,
russ.weight@...ux.dev,
dri-devel@...ts.freedesktop.org,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
nouveau@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org,
Danilo Krummrich <dakr@...nel.org>
Subject: [PATCH v6 1/5] 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@...nel.org>
Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
Signed-off-by: Danilo Krummrich <dakr@...nel.org>
---
rust/macros/module.rs | 4 ++++
1 file changed, 4 insertions(+)
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}\");
}}
--
2.48.1
Powered by blists - more mailing lists