Re: [PATCH v4 7/9] rust: configfs: use `LocalModule` for `THIS_MODULE`
"Gary Guo" <[email protected]>
| Newsgroups | org.kernel.vger.linux-modules,dev.linux.lists.driver-core,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-block,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-pci,org.kernel.vger.netdev,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Tue Jun 23, 2026 at 7:29 AM BST, Alvin Sun wrote: > 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. > > Reviewed-by: Andreas Hindborg <[email protected]> > Signed-off-by: Alvin Sun <[email protected]> > --- > drivers/block/rnull/configfs.rs | 6 ++---- > rust/kernel/configfs.rs | 8 +++++--- > 2 files changed, 7 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..b542422115461 100644 > --- a/rust/kernel/configfs.rs > +++ b/rust/kernel/configfs.rs > @@ -875,7 +875,7 @@ 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::<LocalModule>(), This should be `crate::LocalModule`. Best, Gary > /// &CONFIGURATION_ATTRS > /// ); > /// > @@ -1021,7 +1021,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::<LocalModule>(), > + &[<$ data:upper _ATTRS >] > ); > )? > > @@ -1030,7 +1031,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::<LocalModule>(), > + &[<$ data:upper _ATTRS >] > ); > )? >