From: Alvin Sun <alvin.sun@linux.dev>
To: "Gary Guo" <gary@garyguo.net>, "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"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>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <david@davidgow.net>,
"Rae Moar" <raemoar63@gmail.com>,
"Breno Leitao" <leitao@debian.org>,
"Jens Axboe" <axboe@kernel.dk>,
"Dave Ertman" <david.m.ertman@intel.com>,
"Leon Romanovsky" <leon@kernel.org>,
"Igor Korotin" <igor.korotin@linux.dev>,
"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Christian Brauner" <brauner@kernel.org>,
"Carlos Llamas" <cmllamas@google.com>
Cc: rust-for-linux@vger.kernel.org, linux-modules@vger.kernel.org,
driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org,
nova-gpu@lists.linux.dev, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 07/10] rust: configfs: use `LocalModule` for `THIS_MODULE`
Date: Fri, 26 Jun 2026 10:35:43 +0800 [thread overview]
Message-ID: <34a009d9-a1f3-4347-9e92-866ec05ddb60@linux.dev> (raw)
In-Reply-To: <DJI7IOXAD84M.2F6VSBY64BO62@garyguo.net>
On 6/25/26 22:40, Gary Guo wrote:
> On Wed Jun 24, 2026 at 4:00 PM 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.
>>
>> Assisted-by: opencode:glm-5.2
>> Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
>> Acked-by: Danilo Krummrich <dakr@kernel.org>
>> Signed-off-by: Alvin Sun <alvin.sun@linux.dev>
>> ---
>> 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..c31d7882e216d 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::<crate::LocalModule>(),
>> /// &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>(),
> ^ You only changed one single place. This is still plain `LocalModule`.
Initially I wrote it as `crate::LocalModule`, but clippy warned about it. So
instead of putting the crate path in the macro body, I added `use
crate::LocalModule` in the calling file.
```
warning: `crate` references the macro call's crate
--> rust/kernel/configfs.rs:1024:59
|
1024 | ... $crate::module::this_module::<crate::LocalModule>(),
| ^^^^^ help:
to reference the macro definition's crate, use: `$crate`
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#crate_in_macro_def
= note: `-W clippy::crate-in-macro-def` implied by `-W clippy::all`
= help: to override `-W clippy::all` add
`#[allow(clippy::crate_in_macro_def)]`
warning: 1 warning emitted
```
Alternatively, `#[allow(clippy::crate_in_macro_def)]` could be added on
the macro
definition. Would you suggest that approach?
Best regards,
Alvin
>
> Best,
> Gary
>
>> + &[<$ 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 >]
>> );
>> )?
>>
>
next prev parent reply other threads:[~2026-06-26 2:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 14:59 [PATCH v6 00/10] Fix missing fops.owner in Rust DRM/misc abstractions Alvin Sun
2026-06-24 15:00 ` [PATCH v6 01/10] rust: module: move module types into `module.rs` Alvin Sun
2026-06-25 14:37 ` Gary Guo
2026-06-24 15:00 ` [PATCH v6 02/10] rust: module: add `THIS_MODULE` const to `ModuleMetadata` trait Alvin Sun
2026-06-24 15:00 ` [PATCH v6 03/10] rust: doctest: add LocalModule fallback for #[vtable] ThisModule Alvin Sun
2026-06-24 15:00 ` [PATCH v6 04/10] rust: macros: auto-insert OwnerModule in #[vtable] Alvin Sun
2026-06-24 15:00 ` [PATCH v6 05/10] rust: drm: set fops.owner from driver module pointer Alvin Sun
2026-06-24 15:00 ` [PATCH v6 06/10] rust: miscdevice: " Alvin Sun
2026-06-24 15:00 ` [PATCH v6 07/10] rust: configfs: use `LocalModule` for `THIS_MODULE` Alvin Sun
2026-06-25 14:40 ` Gary Guo
2026-06-26 2:35 ` Alvin Sun [this message]
2026-06-26 14:41 ` Gary Guo
2026-06-24 15:00 ` [PATCH v6 08/10] rust: binder: " Alvin Sun
2026-06-24 15:00 ` [PATCH v6 09/10] rust: macros: remove `THIS_MODULE` static from `module!` Alvin Sun
2026-06-24 15:00 ` [PATCH v6 10/10] rust: module: update MAINTAINERS to cover module.rs Alvin Sun
2026-06-25 14:39 ` Gary Guo
2026-06-26 3:01 ` Alvin Sun
2026-06-26 14:41 ` Gary Guo
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=34a009d9-a1f3-4347-9e92-866ec05ddb60@linux.dev \
--to=alvin.sun@linux.dev \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=arnd@arndb.de \
--cc=arve@android.com \
--cc=atomlin@atomlin.com \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=brauner@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=cmllamas@google.com \
--cc=da.gomez@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=david.m.ertman@intel.com \
--cc=david@davidgow.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=fujita.tomonori@gmail.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=igor.korotin@linux.dev \
--cc=kunit-dev@googlegroups.com \
--cc=kwilczynski@kernel.org \
--cc=leitao@debian.org \
--cc=leon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=mcgrof@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=raemoar63@gmail.com \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=samitolvanen@google.com \
--cc=simona@ffwll.ch \
--cc=tkjos@android.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.