From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B37BB374721 for ; Fri, 26 Jun 2026 02:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782441397; cv=none; b=rpO8HMq5cv4CoajHZuwlVVb8VEsaiKYP1pP/KoBSRruG1vz+zwer9It35eyi+LvbWJNV50E7oDBmq02/c21ZuN9c3QvMlSJtiimS6jEGX92H+mLZgFwxkaJiWU3bLIgdfS9Z6ZFAGbjVoZcgsBpIg6nmfTckxY+Pqhi4M1MCksE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782441397; c=relaxed/simple; bh=DaU6X1yK4xkTvUSgXQBLEhqd1am01gmJC7t4LMkX6kw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uHyKvAeTb6y4Ex4VFy2r6uPDJYDAVDNxJywRQnFlXUzucPKkjwY0aS8QobvJgv0c5RH/kKCrwrw8G96ylIrlAGSStdkkkK5ix51DsV9ue36br6GEFhBFLL7UIWinPzne1ullZanCTnLV7vDs+Vosvfx+X3VAd5ZlXhLtPfcQ4sE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HBuW3/F0; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HBuW3/F0" Message-ID: <34a009d9-a1f3-4347-9e92-866ec05ddb60@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782441379; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CegCkrNaBHbS0Oj9Ldk9o9PP5HExitwf901kAMkwPm8=; b=HBuW3/F090mBYZL37N1SgKew3WdUYWwEq1G3Gdz0VQvXxEOspJwKy5dzjesLiz4H9/7nEI Ld3FlxQNHmujt6uefJXigfVXjSPvhIU36Ndkyfamoz1N4Ux0yrRNByHqzMl9c55vVs8eVK xqqSNZuaW5n7thiQ8n0QYdK/uoHGbEk= Date: Fri, 26 Jun 2026 10:35:43 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v6 07/10] rust: configfs: use `LocalModule` for `THIS_MODULE` To: Gary Guo , Miguel Ojeda , Boqun Feng , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , David Airlie , Simona Vetter , Daniel Almeida , Arnd Bergmann , Brendan Higgins , David Gow , Rae Moar , Breno Leitao , Jens Axboe , Dave Ertman , Leon Romanovsky , Igor Korotin , FUJITA Tomonori , Bjorn Helgaas , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , =?UTF-8?Q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas 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 References: <20260624-fix-fops-owner-v6-0-5295e333cb3e@linux.dev> <20260624-fix-fops-owner-v6-7-5295e333cb3e@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvin Sun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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::()`, 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 >> Acked-by: Danilo Krummrich >> Signed-off-by: Alvin Sun >> --- >> 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 >> /// >::new_with_child_ctor::( >> -/// &THIS_MODULE, >> +/// ::kernel::module::this_module::(), >> /// &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::( >> - &THIS_MODULE, &[<$ data:upper _ATTRS >] >> + $crate::module::this_module::(), > ^ 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::(),      |                                                     ^^^^^ 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::( >> - &THIS_MODULE, &[<$ data:upper _ATTRS >] >> + $crate::module::this_module::(), >> + &[<$ data:upper _ATTRS >] >> ); >> )? >> >