From nobody Mon Feb 9 03:13:58 2026 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D68FE3491C9 for ; Sat, 10 Jan 2026 15:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768057772; cv=none; b=fb0cFl1+Uhb/6G0QLQEKcdO2S2yyp7Y1XE+zbNZdoXLjAY8jXG5ES8PEkf3/mpHHQyu0ljOkwHuam13bkWNqorHW5SosvuYmYqImzFr/XnIl2QFUbmenoTZA948KYZaMisdxhhvRPjRrQHhP3k4ffVKI2HhJk5jKtCfLb4uqEoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768057772; c=relaxed/simple; bh=1FB+uT1pALfUGFef4CiqxjN0XjuunSUgAxAx5cQ/hwo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bdVJD+dUbwltbJ0FKMJg8vudQd5j9eLeIcU6/aaPvDqMJUIAqtrp+x01FruGg9OOsCKgAPl1u1iCuS/A4roGPMEijxzMrWxoZ68BSWjqSwe5Nf1imeQL9Xk+ee2d4kIENBhJqdE7zw+Ckd+ycMzt79Jffx5qEwyxJwAqXJ7wVbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CKMMlPNv; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CKMMlPNv" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-59b79451206so2365450e87.1 for ; Sat, 10 Jan 2026 07:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768057762; x=1768662562; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Vqf7LCg+sg6Hx5J5qs/p3xtmlckbxwDqMrE5j+qRjSY=; b=CKMMlPNvXpMm1GvHDNAatxWV55AUHOZ/PGrn124XPDPrWuSgUdhRqbmUHGlZ82BJht nDTSTcpsiNo844EQgZ3vRE3LIbgC2L/2tCwAtw57a3RBAnCAc2tBunEZLSzTXwO5hQkt Z6vfxBO1KrdwOGWMk6hMWGHp8ITA2UxQYbDFMEIXcT7HorZ26Y+U1wUNBI6rCV+MhRN7 6Qm5OtL+PKlAL5O0Rg5NGEdDiGmuEuq1/VCWt+EHHMOm/h44SEkzvDM36OYNJFCPt0e8 6umbr6gRTqplzwwdwSbSJP1AGItO/gbdTOcIr0y3MJztwvAHEDHcJhdPsODc4nqFxxog 6WVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768057762; x=1768662562; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Vqf7LCg+sg6Hx5J5qs/p3xtmlckbxwDqMrE5j+qRjSY=; b=REf81kByeAIhn5RJiUQCVa3J4xmov3QiD+eSaHvuykDF1VK+3ktWTg5gcFv3Yrjd3L A25r9ejKDCsYX957ZP0/tAO7IGkKYemCX9YrsOj5RvYFpoA0u4uapx/VXWLfvhT9p8k1 qC+pkC6K3X1xDCsGelP7lsKNExULjkSo76OonCe5Fi7EpQofnF+dsdwSsAAr+AkoMBvX CSBvnFqgzSBhA9RuFQmqpzYtM/9NNYV3T4wdyLsEcN5RmxxyOD12b826H34kKBoFRyoq MiPfXzzFCxHryGP0MHe/JB8MbzsozwbI+rZKoC3PGZ1hZ+sRwCELHPlQEmzY5Mtl5bhS g+SA== X-Forwarded-Encrypted: i=1; AJvYcCVe15Rm4v5vx83rQ0/QTHlKkExZXUTves8KRR+I575fckaYtgWvaZovz8wMUDCrpQF2qRPINjpxtk2BHWc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3pI6tYxpqS/wPMQQqJXT7CqTD1r6Y7JNNEjkPARTlCPCB9yp5 DoAZ2HG6h9vqE0ZRgcZSszFRNCVAj1FUDA7fmkx/g6DZcHDxMCCXadSX X-Gm-Gg: AY/fxX6/zBSByiK6TOZ/WQhkQo8B3j/m570ImYJi66RtqVcDlI5LvWJPWPFNmrhc86/ yt2UagJrkro24+hJ2W4IMU79Kgq/XfyyH78lZ0at5EoE8qdD/WnhRUQo5ALvE2w0DQmHoi0oYuG J203nBv1mQzsWWK/e2o8ooWU3/4Reb8O0nVsQw2+yKAJXvtpa3drOTPxmYgeHbn7lpKsoiuuK9K 6mnxqu244iqeV0CPoeVkt+bsdNFB/BEMD+xSYqO6UnXEGAAMvdK/Or5dxfXPbX1QhnofxqDwluS zIlWOCJWnOpXu0e4E9f03EMarfUWYcitphjrilkguE5htm6/m+lALViInx19mawSvX7m6L8h7Wr eVg4xHk0fDdIkg9rQJfXNPlbbr6x7rOyBLKYPiqcsmz/5EoCZND5IufAdPKbDgTW98iQiF8zW/4 75eX1gIE3F04hd49a1rJUNMq5e1PNXb444WQi1gWrqTdTbhaf2++uQrmKT1aHqtvQ7eYDynYOK X-Google-Smtp-Source: AGHT+IHEE1TGipeoD2/6eyBBIsojGiNqm7JwcbPiYjVFBwHDR5nwSai8es4nGi6I/fgjxe+bGdX/zQ== X-Received: by 2002:a05:6512:b01:b0:59b:8483:8d97 with SMTP id 2adb3069b0e04-59b84838e5amr1204577e87.13.1768057761899; Sat, 10 Jan 2026 07:09:21 -0800 (PST) Received: from LT-5CG5341NQ4.nordic.imtech.com (37-33-148-7.bb.dnainternet.fi. [37.33.148.7]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-59b75543a64sm2137059e87.49.2026.01.10.07.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Jan 2026 07:09:21 -0800 (PST) From: Kari Argillander Date: Sat, 10 Jan 2026 17:08:04 +0200 Subject: [PATCH RFC v3 06/15] rust: configfs: use new THIS_MODULE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260110-this_module_fix-v3-6-97a3d9c14e8b@gmail.com> References: <20260110-this_module_fix-v3-0-97a3d9c14e8b@gmail.com> In-Reply-To: <20260110-this_module_fix-v3-0-97a3d9c14e8b@gmail.com> To: Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Alexandre Courbot Cc: Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , Kari Argillander X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1768057742; l=5277; i=kari.argillander@gmail.com; s=20251219; h=from:subject:message-id; bh=1FB+uT1pALfUGFef4CiqxjN0XjuunSUgAxAx5cQ/hwo=; b=KTu6JmsvpKxaB1JzW8EXhr264WUGMX9sqMRbv98Urte4QvFUB+KimYWM6CyVbNCSLfejIngg3 769ilDyNnBwDbNGyi+QKw7almLRAojJtFeFDvsqYuTex4HO29lmm4rN X-Developer-Key: i=kari.argillander@gmail.com; a=ed25519; pk=RwSxyhTpE3z4sywdDbIkC3q33ZQLNyhYWxT44iTY6r4= We have new THIS_MODULE and ThisModule is now trait. Pass THIS_MODULE as generic type parameter which is current convention. Signed-off-by: Kari Argillander --- drivers/block/rnull/configfs.rs | 2 +- rust/kernel/configfs.rs | 46 +++++++++++++++++++++----------------= ---- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/block/rnull/configfs.rs b/drivers/block/rnull/configfs= .rs index 2f5a7da03af5..7223ee7c3032 100644 --- a/drivers/block/rnull/configfs.rs +++ b/drivers/block/rnull/configfs.rs @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 =20 -use super::{NullBlkDevice, THIS_MODULE}; +use super::NullBlkDevice; use kernel::{ block::mq::gen_disk::{GenDisk, GenDiskBuilder}, c_str, diff --git a/rust/kernel/configfs.rs b/rust/kernel/configfs.rs index fe80439ab21f..908cb98d404f 100644 --- a/rust/kernel/configfs.rs +++ b/rust/kernel/configfs.rs @@ -110,16 +110,21 @@ //! [C documentation]: srctree/Documentation/filesystems/configfs.rst //! [`rust_configfs.rs`]: srctree/samples/rust/rust_configfs.rs =20 -use crate::alloc::flags; -use crate::container_of; -use crate::page::PAGE_SIZE; -use crate::prelude::*; -use crate::str::CString; -use crate::sync::Arc; -use crate::sync::ArcBorrow; -use crate::types::Opaque; -use core::cell::UnsafeCell; -use core::marker::PhantomData; +use crate::{ + alloc::flags, + container_of, + page::PAGE_SIZE, + prelude::*, + str::CString, + sync::Arc, + sync::ArcBorrow, + this_module::ThisModule, + types::Opaque, // +}; +use core::{ + cell::UnsafeCell, + marker::PhantomData, // +}; =20 /// A configfs subsystem. /// @@ -744,8 +749,7 @@ macro_rules! impl_item_type { ($tpe:ty) =3D> { impl ItemType<$tpe, Data> { #[doc(hidden)] - pub const fn new_with_child_ctor( - owner: &'static ThisModule, + pub const fn new_with_child_ctor( attributes: &'static AttributeList, ) -> Self where @@ -754,7 +758,7 @@ pub const fn new_with_child_ctor( { Self { item_type: Opaque::new(bindings::config_item_type { - ct_owner: owner.as_ptr(), + ct_owner: TM::OWNER.as_ptr(), ct_group_ops: GroupOperationsVTable::= ::vtable_ptr().cast_mut(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr().cast_mut(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), @@ -765,13 +769,12 @@ pub const fn new_with_child_ctor( } =20 #[doc(hidden)] - pub const fn new( - owner: &'static ThisModule, + pub const fn new( attributes: &'static AttributeList, ) -> Self { Self { item_type: Opaque::new(bindings::config_item_type { - ct_owner: owner.as_ptr(), + ct_owner: TM::OWNER.as_ptr(), ct_group_ops: core::ptr::null_mut(), ct_item_ops: ItemOperationsVTable::<$tpe, Data>::v= table_ptr().cast_mut(), ct_attrs: core::ptr::from_ref(attributes).cast_mut= ().cast(), @@ -875,8 +878,7 @@ fn as_ptr(&self) -> *const bindings::config_item_type { /// =3D kernel::configfs::ItemType::< /// configfs::Subsystem, /// Configuration -/// >::new_with_child_ctor::( -/// THIS_MODULE.as_ref(), +/// >::new_with_child_ctor::( /// &CONFIGURATION_ATTRS /// ); /// @@ -1019,8 +1021,8 @@ macro_rules! configfs_attrs { const [<$no_child:upper>]: bool =3D true; =20 static [< $data:upper _TPE >] : $crate::configfs::Item= Type<$container, $data> =3D - $crate::configfs::ItemType::<$container, $data>::n= ew::( - THIS_MODULE.as_ref(), &[<$ data:upper _ATTRS >] + $crate::configfs::ItemType::<$container, $data>::n= ew::( + &[<$ data:upper _ATTRS >] ); )? =20 @@ -1028,8 +1030,8 @@ macro_rules! configfs_attrs { static [< $data:upper _TPE >]: $crate::configfs::ItemType<$container, $data> =3D $crate::configfs::ItemType::<$container, $data= >:: - new_with_child_ctor::( - THIS_MODULE.as_ref(), &[<$ data:upper _ATT= RS >] + new_with_child_ctor::( + &[<$ data:upper _ATTRS >] ); )? =20 --=20 2.43.0