diff options
| author | Gary Guo <gary@garyguo.net> | 2026-01-12 17:07:21 +0000 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-01-28 13:44:17 +0100 |
| commit | d421fa4f73f59c512b30338a3453b62ed8fd9122 (patch) | |
| tree | 39af577de8c3efd6bda0277cd4b3aad0d203ffe9 /rust | |
| parent | 3d5731a6be6a43d8c90d766e1404502c44545241 (diff) | |
rust: macros: rearrange `#[doc(hidden)]` in `module!` macro
This `#[doc(hidden)]` can just be applied on a module to hide anything
within.
Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260112170919.1888584-11-gary@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/macros/module.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 9e0242d42d51..e16298e520c7 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -77,7 +77,6 @@ impl<'a> ModInfoBuilder<'a> { ); let item = quote! { #cfg - #[doc(hidden)] #[cfg_attr(not(target_os = "macos"), link_section = ".modinfo")] #[used(compiler)] pub static #counter: [u8; #length] = *#string; @@ -528,6 +527,7 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { } // Double nested modules, since then nobody can access the public items inside. + #[doc(hidden)] mod __module_init { mod __module_init { use pin_init::PinInit; @@ -537,7 +537,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { // This may be best done another way later on, e.g. as a new modinfo // key or a new section. For the moment, keep it simple. #[cfg(MODULE)] - #[doc(hidden)] #[used(compiler)] static __IS_RUST_MODULE: () = (); @@ -550,7 +549,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { /// This function must not be called after module initialization, because it may be /// freed after that completes. #[cfg(MODULE)] - #[doc(hidden)] #[no_mangle] #[link_section = ".init.text"] pub unsafe extern "C" fn init_module() -> ::kernel::ffi::c_int { @@ -561,14 +559,12 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { } #[cfg(MODULE)] - #[doc(hidden)] #[used(compiler)] #[link_section = ".init.data"] static __UNIQUE_ID___addressable_init_module: unsafe extern "C" fn() -> i32 = init_module; #[cfg(MODULE)] - #[doc(hidden)] #[no_mangle] #[link_section = ".exit.text"] pub extern "C" fn cleanup_module() { @@ -582,7 +578,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { } #[cfg(MODULE)] - #[doc(hidden)] #[used(compiler)] #[link_section = ".exit.data"] static __UNIQUE_ID___addressable_cleanup_module: extern "C" fn() = cleanup_module; @@ -591,7 +586,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { // and the identifiers need to be unique. #[cfg(not(MODULE))] #[cfg(not(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS))] - #[doc(hidden)] #[link_section = #initcall_section] #[used(compiler)] pub static #ident_initcall: extern "C" fn() -> @@ -602,7 +596,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { ::core::arch::global_asm!(#global_asm); #[cfg(not(MODULE))] - #[doc(hidden)] #[no_mangle] pub extern "C" fn #ident_init() -> ::kernel::ffi::c_int { // SAFETY: This function is inaccessible to the outside due to the double @@ -612,7 +605,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> { } #[cfg(not(MODULE))] - #[doc(hidden)] #[no_mangle] pub extern "C" fn #ident_exit() { // SAFETY: |
