Replace the `THIS_MODULE` static reference in the `configfs_attrs!` macro with `this_module::<LocalModule>()`, and update rnull to import `LocalModule` instead of `THIS_MODULE`, consistent with the move of `THIS_MODULE` into the `ModuleMetadata` trait.
Assisted-by: opencode:glm-5.2 Reviewed-by: Andreas Hindborg <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Signed-off-by: Alvin Sun <[email protected]> --- drivers/block/rnull/configfs.rs | 6 ++---- rust/kernel/configfs.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs.rs index c10a55fc58948..b2547ad1e5ddd 100644 --- a/drivers/block/rnull/configfs.rs +++ b/drivers/block/rnull/configfs.rs @@ -1,9 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -use super::{ - NullBlkDevice, - THIS_MODULE, // -}; +use super::NullBlkDevice; +use crate::LocalModule; use kernel::{ block::mq::gen_disk::{ GenDisk, diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs index 2339c6467325d..cd082b83e9e74 100644 --- a/rust/kernel/configfs.rs +++ b/rust/kernel/configfs.rs @@ -875,13 +875,14 @@ fn as_ptr(&self) -> *const bindings::config_item_type { /// configfs::Subsystem<Configuration>, /// Configuration /// >::new_with_child_ctor::<N,Child>( -/// &THIS_MODULE, +/// ::kernel::module::this_module::<crate::LocalModule>(), /// &CONFIGURATION_ATTRS /// ); /// /// &CONFIGURATION_TPE /// } /// ``` +#[allow(clippy::crate_in_macro_def)] #[macro_export] macro_rules! configfs_attrs { ( @@ -1021,7 +1022,8 @@ macro_rules! configfs_attrs { static [< $data:upper _TPE >] : $crate::configfs::ItemType<$container, $data> = $crate::configfs::ItemType::<$container, $data>::new::<N>( - &THIS_MODULE, &[<$ data:upper _ATTRS >] + $crate::module::this_module::<crate::LocalModule>(), + &[<$ data:upper _ATTRS >] ); )? @@ -1030,7 +1032,8 @@ macro_rules! configfs_attrs { $crate::configfs::ItemType<$container, $data> = $crate::configfs::ItemType::<$container, $data>:: new_with_child_ctor::<N, $child>( - &THIS_MODULE, &[<$ data:upper _ATTRS >] + $crate::module::this_module::<crate::LocalModule>(), + &[<$ data:upper _ATTRS >] ); )? -- 2.43.0

