Skip to content

Commit c852a77

Browse files
nbdd0121BennoLossin
authored andcommitted
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 <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Signed-off-by: Gary Guo <[email protected]>
1 parent fc719cd commit c852a77

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

rust/macros/module.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ impl<'a> ModInfoBuilder<'a> {
7777
);
7878
let item = quote! {
7979
#cfg
80-
#[doc(hidden)]
8180
#[cfg_attr(not(target_os = "macos"), link_section = ".modinfo")]
8281
#[used(compiler)]
8382
pub static #counter: [u8; #length] = *#string;
@@ -528,6 +527,7 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
528527
}
529528

530529
// Double nested modules, since then nobody can access the public items inside.
530+
#[doc(hidden)]
531531
mod __module_init {
532532
mod __module_init {
533533
use pin_init::PinInit;
@@ -537,7 +537,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
537537
// This may be best done another way later on, e.g. as a new modinfo
538538
// key or a new section. For the moment, keep it simple.
539539
#[cfg(MODULE)]
540-
#[doc(hidden)]
541540
#[used(compiler)]
542541
static __IS_RUST_MODULE: () = ();
543542

@@ -550,7 +549,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
550549
/// This function must not be called after module initialization, because it may be
551550
/// freed after that completes.
552551
#[cfg(MODULE)]
553-
#[doc(hidden)]
554552
#[no_mangle]
555553
#[link_section = ".init.text"]
556554
pub unsafe extern "C" fn init_module() -> ::kernel::ffi::c_int {
@@ -561,14 +559,12 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
561559
}
562560

563561
#[cfg(MODULE)]
564-
#[doc(hidden)]
565562
#[used(compiler)]
566563
#[link_section = ".init.data"]
567564
static __UNIQUE_ID___addressable_init_module: unsafe extern "C" fn() -> i32 =
568565
init_module;
569566

570567
#[cfg(MODULE)]
571-
#[doc(hidden)]
572568
#[no_mangle]
573569
#[link_section = ".exit.text"]
574570
pub extern "C" fn cleanup_module() {
@@ -582,7 +578,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
582578
}
583579

584580
#[cfg(MODULE)]
585-
#[doc(hidden)]
586581
#[used(compiler)]
587582
#[link_section = ".exit.data"]
588583
static __UNIQUE_ID___addressable_cleanup_module: extern "C" fn() = cleanup_module;
@@ -591,7 +586,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
591586
// and the identifiers need to be unique.
592587
#[cfg(not(MODULE))]
593588
#[cfg(not(CONFIG_HAVE_ARCH_PREL32_RELOCATIONS))]
594-
#[doc(hidden)]
595589
#[link_section = #initcall_section]
596590
#[used(compiler)]
597591
pub static #ident_initcall: extern "C" fn() ->
@@ -602,7 +596,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
602596
::core::arch::global_asm!(#global_asm);
603597

604598
#[cfg(not(MODULE))]
605-
#[doc(hidden)]
606599
#[no_mangle]
607600
pub extern "C" fn #ident_init() -> ::kernel::ffi::c_int {
608601
// SAFETY: This function is inaccessible to the outside due to the double
@@ -612,7 +605,6 @@ pub(crate) fn module(info: ModuleInfo) -> Result<TokenStream> {
612605
}
613606

614607
#[cfg(not(MODULE))]
615-
#[doc(hidden)]
616608
#[no_mangle]
617609
pub extern "C" fn #ident_exit() {
618610
// SAFETY:

0 commit comments

Comments
 (0)