From: Gary Guo <gary@kernel.org>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Petr Pavlu" <petr.pavlu@suse.com>,
"Daniel Gomez" <da.gomez@kernel.org>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Aaron Tomlin" <atomlin@atomlin.com>
Cc: rust-for-linux@vger.kernel.org,
Tamir Duberstein <tamird@gmail.com>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 10/12] rust: macros: rearrange `#[doc(hidden)]` in `module!` macro
Date: Mon, 12 Jan 2026 17:07:21 +0000 [thread overview]
Message-ID: <20260112170919.1888584-11-gary@kernel.org> (raw)
In-Reply-To: <20260112170919.1888584-1-gary@kernel.org>
From: Gary Guo <gary@garyguo.net>
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>
---
rust/macros/module.rs | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index 9e0242d42d51f..e16298e520c78 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -77,7 +77,6 @@ fn emit_base(&mut self, field: &str, content: &str, builtin: bool, param: bool)
);
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 @@ impl ::kernel::ModuleMetadata for #type_ {
}
// 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 @@ mod __module_init {
// 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 @@ mod __module_init {
/// 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 @@ mod __module_init {
}
#[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 extern "C" fn cleanup_module() {
}
#[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 extern "C" fn cleanup_module() {
// 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 extern "C" fn cleanup_module() {
::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 extern "C" fn #ident_init() -> ::kernel::ffi::c_int {
}
#[cfg(not(MODULE))]
- #[doc(hidden)]
#[no_mangle]
pub extern "C" fn #ident_exit() {
// SAFETY:
--
2.51.2
next prev parent reply other threads:[~2026-01-12 17:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 17:07 [PATCH v3 00/12] refactor Rust proc macros with `syn` Gary Guo
2026-01-12 17:07 ` [PATCH v3 01/12] rust: pin-init: internal: remove proc-macro[2] and quote workarounds Gary Guo
2026-01-12 17:07 ` [PATCH v3 02/12] rust: macros: use `quote!` from vendored crate Gary Guo
2026-01-19 7:09 ` David Gow
2026-01-12 17:07 ` [PATCH v3 03/12] rust: macros: convert `#[vtable]` macro to use `syn` Gary Guo
2026-01-17 19:25 ` Benno Lossin
2026-01-12 17:07 ` [PATCH v3 04/12] rust: macros: use `syn` to parse `module!` macro Gary Guo
2026-01-17 20:12 ` Benno Lossin
2026-01-12 17:07 ` [PATCH v3 05/12] rust: macros: use `quote!` for " Gary Guo
2026-01-12 17:07 ` [PATCH v3 06/12] rust: macros: convert `#[export]` to use `syn` Gary Guo
2026-01-12 17:07 ` [PATCH v3 07/12] rust: macros: convert `concat_idents!` " Gary Guo
2026-01-12 17:07 ` [PATCH v3 08/12] rust: macros: convert `#[kunit_tests]` macro " Gary Guo
2026-01-17 20:09 ` Benno Lossin
2026-01-19 7:10 ` David Gow
2026-01-12 17:07 ` [PATCH v3 09/12] rust: macros: allow arbitrary types to be used in `module!` macro Gary Guo
2026-01-12 17:07 ` Gary Guo [this message]
2026-01-12 17:07 ` [PATCH v3 11/12] rust: kunit: use `pin_init::zeroed` instead of custom null value Gary Guo
2026-01-19 7:10 ` David Gow
2026-01-12 17:07 ` [PATCH v3 12/12] rust: macros: support `#[cfg]` properly in `#[vtable]` macro Gary Guo
2026-01-12 17:48 ` Tamir Duberstein
2026-01-13 13:11 ` [PATCH] " Gary Guo
2026-01-13 13:39 ` Tamir Duberstein
2026-01-13 14:09 ` Gary Guo
2026-01-13 14:23 ` Tamir Duberstein
2026-01-13 17:05 ` [PATCH v2] " Gary Guo
2026-01-17 20:09 ` Benno Lossin
2026-01-28 15:09 ` [PATCH v3 00/12] refactor Rust proc macros with `syn` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260112170919.1888584-11-gary@kernel.org \
--to=gary@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=atomlin@atomlin.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=da.gomez@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mcgrof@kernel.org \
--cc=ojeda@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=tamird@gmail.com \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.