From nobody Sun Feb 8 19:55:03 2026 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.51]) (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 41BC61531C1 for ; Wed, 28 Jan 2026 23:30:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769643026; cv=none; b=NithmPM1WQ8kvBq2A+xx2NRC5+8U7WIGAJT+WqrpGdwOdNNzhB0SVkEMl606+BQyJWa+pJn7amd3W6yScHAWayN75MbbKfA2FepD87++ujxfoEQaBoEKpp6qH+brD8XY+bUHUcrlZCmEFhif7/OEHwbC23jbuPq4l044PXXIOKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769643026; c=relaxed/simple; bh=OWcfZiYWS0H6ctpWcE+xkPHvQjej9ptDYntcK8zIjcw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HBmlPuwGNjJVPY7Jk096nnCe/QGcDcHqBRV8tO78bj1d5weUO8OhW9B5cVATn+NztZAKufB/D2f5uNQEGwweytGDIwnP4Cuk1jJ+Dfi2jT4wL7Ye9MIJ8yRMmCQHGNiqRs3E+3BxhUzpPQP/w2Htvg+WhziDrU1Gd0MLF+9KJWM= 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=gD8jlORE; arc=none smtp.client-ip=209.85.160.51 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="gD8jlORE" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-40970f97638so189394fac.3 for ; Wed, 28 Jan 2026 15:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769643024; x=1770247824; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:from:to:cc:subject :date:message-id:reply-to; bh=HK2cJpoHs1cW08tNlDAhBYjQE8db82PEiBJhgotTdb4=; b=gD8jlOREgJOcRXyjY6LTPfLO2DPUND05ze/P9W/p8W47M6Jvpr2OEyxLEZ9Gc5QuWI tYnhRTzY1i7Y4yHU5sSFbz7Nvz2KDyCzMqjik8+2AAM1/M6XC2dd0jq882LKGhiUZ6l+ yWJa2wCIlCzmzw6L6hIx7Ztv0pSNj5JfCt+z51+iLxw+p3JWF1yHd1zf3coOnnmDaqRY DpuGJsCywo+83Zq9oDOm4LeRMarPB6RnpApg5R3pJJwaF+oWsudcNduk7LQS+kFqdpec yFchH/ZmOGS89PSp0Cj92BOzxm3k/sXBUjTOh+Z/nCfNgN9woPSzPtwLkKsrDOy2dQcY rGog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769643024; x=1770247824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HK2cJpoHs1cW08tNlDAhBYjQE8db82PEiBJhgotTdb4=; b=w2BC7++vwOdmj2adN+xOkX7YjmO3GU/vqFECDnEIGbeCYQTn+TUXFKIMQqwBFzhpx1 fJI9UV2oWYhxLe6HvmOypuVZ1YY6eMWuvCeSbddKX6b+jeopddTbrF/EGjs5P3q/crXp DgRX06ALCX22/gPwQpt6vAvf94sm2gx5RNWoJBPp5ZC+sYdZ1m6wfOh+67DVVpsgYZEs TCnQSzEMm4C3amICBEXlRc8dmwcWYJE2f/Jw7JPYxc7RiPHBBEgToELjrcNhyDHOa1he 4lfmU61OvdVKa8t8GQDcSV0WZiVJkbuhb5ixMeZeeJvogwsfqGAgIpND4u8/HB5LNWVJ QcLA== X-Gm-Message-State: AOJu0Yx/aMJ1Kz33sj6XL93Cz2GH2EogCeMOcpQyBiiOVXs8dP5H+1CO sU2JzjboAx81QOPVJuGZt2JgJ6+Q1OiDOGky+1NkVmb2N2KcB6kKjxoqKxuOAA== X-Gm-Gg: AZuq6aImEG+HzBL37jgl6/ormElTUKelx/owMcXoXVSJsKDVEBiNSR2OHgacemnBI3K uIjGM5Apf41yJkqJyGGdl3mm3RQWfbj7zwcyU05Bw0ZQ3xJ/DBvGPx8hVNUJKlxjDy2SqkOOcSK AGSu6LxLYEEGP9tSkMEtCvWQ9KoHmbWmU2vZzaTd+gIltSTPEwHJeghQY3upKua/p4xjVv9bZAh YifHm/vvX5FVLT8gA84IliFMXu1LW5dfjHD+tbxA44pV88/5IF0o1eDqTr8LQsJldwvx/GfASCT Wj2q2qBP8yPLNuBFRdX73+sPmk8yLVClI6C2o9zSABqA96+8F6llMyOMhpOU6IgfdPiGV0RJwSq SNqFdxZy9yBSKM+EmkGJ5ohWvxpoAjQPHWb95m6VMOl6MNWA/HX6LZeYNRbCo+bo7lTCfqWRcVE PRjt5E5tkiMRxYkaG2+LNvja6zMVvOqFiwHOIXkOtZrOe2yu7E0iMMp8KjD25rv20EzRYoXpRHA KQIOE5FxR7e3hg= X-Received: by 2002:a05:620a:4447:b0:8c7:13b8:8b55 with SMTP id af79cd13be357-8c713b8905cmr517714785a.46.1769637223840; Wed, 28 Jan 2026 13:53:43 -0800 (PST) Received: from fauth-a1-smtp.messagingengine.com (fauth-a1-smtp.messagingengine.com. [103.168.172.200]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c713580985sm237855085a.8.2026.01.28.13.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 13:53:43 -0800 (PST) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfauth.phl.internal (Postfix) with ESMTP id 7918BF4006C; Wed, 28 Jan 2026 16:53:42 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 28 Jan 2026 16:53:42 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieeggeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeegleejiedthedvheeggfejveefjeejkefgveffieeujefhueeigfegueehgeeg gfenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvgdpnhgspghrtghpthhtohepgedvpdhmohguvgepshhmthhpohhuthdprhgt phhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehruhhsthdqfhhorhdqlhhinhhugiesvhhgvghrrdhkvghrnhgvlhdrohhr ghdprhgtphhtthhopehrtghusehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoh epghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhgpdhrtghpthhtohep rghrvhgvsegrnhgurhhoihgurdgtohhmpdhrtghpthhtohepthhkjhhoshesrghnughroh hiugdrtghomhdprhgtphhtthhopegsrhgruhhnvghrsehkvghrnhgvlhdrohhrghdprhgt phhtthhopegtmhhllhgrmhgrshesghhoohhglhgvrdgtohhmpdhrtghpthhtoheprghlih gtvghrhihhlhesghhoohhglhgvrdgtohhm X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jan 2026 16:53:41 -0500 (EST) From: Boqun Feng To: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, rcu@vger.kernel.org Cc: Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas , Alice Ryhl , Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , FUJITA Tomonori , Lyude Paul , Thomas Gleixner , Anna-Maria Behnsen , John Stultz , Stephen Boyd , "Yury Norov (NVIDIA)" , Vitaly Wool , Tamir Duberstein , Viresh Kumar , Daniel Almeida , Mitchell Levy , David Gow , Peter Novak , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Subject: [RFC PATCH 6/7] rust: work: Remove `impl_has_work!` Date: Wed, 28 Jan 2026 13:53:29 -0800 Message-ID: <20260128215330.58410-7-boqun.feng@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260128215330.58410-1-boqun.feng@gmail.com> References: <20260128215330.58410-1-boqun.feng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now all in-tree users of `impl_has_work!()` are converted to use `#[derive(HasField)]`, hence remove it. Signed-off-by: Boqun Feng --- rust/kernel/workqueue.rs | 53 ++-------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 2dcfd3eace39..37fbf348c760 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -578,55 +578,6 @@ pub unsafe trait HasWork { unsafe fn work_container_of(ptr: *mut Work) -> *mut Self; } =20 -/// Used to safely implement the [`HasWork`] trait. -/// -/// # Examples -/// -/// ``` -/// use kernel::sync::Arc; -/// use kernel::workqueue::{self, impl_has_work, Work}; -/// -/// struct MyStruct<'a, T, const N: usize> { -/// work_field: Work, 17>, -/// f: fn(&'a [T; N]), -/// } -/// -/// impl_has_work! { -/// impl{'a, T, const N: usize} HasWork, 17> -/// for MyStruct<'a, T, N> { self.work_field } -/// } -/// ``` -#[macro_export] -macro_rules! impl_has_work { - ($(impl$({$($generics:tt)*})? - HasWork<$work_type:ty $(, $id:tt)?> - for $self:ty - { self.$field:ident } - )*) =3D> {$( - // SAFETY: The implementation of `raw_get_work` only compiles if t= he field has the right - // type. - unsafe impl$(<$($generics)+>)? $crate::workqueue::HasWork<$work_ty= pe $(, $id)?> for $self { - #[inline] - unsafe fn raw_get_work(ptr: *mut Self) -> *mut $crate::workque= ue::Work<$work_type $(, $id)?> { - // SAFETY: The caller promises that the pointer is not dan= gling. - unsafe { - ::core::ptr::addr_of_mut!((*ptr).$field) - } - } - - #[inline] - unsafe fn work_container_of( - ptr: *mut $crate::workqueue::Work<$work_type $(, $id)?>, - ) -> *mut Self { - // SAFETY: The caller promises that the pointer points at = a field of the right type - // in the right kind of struct. - unsafe { $crate::container_of!(ptr, Self, $field) } - } - } - )*}; -} -pub use impl_has_work; - impl Field for Work {} =20 /// SAFETY: Per the safety requirement of `HasField`, `raw_get_field()` an= d `field_container_of()` @@ -746,8 +697,8 @@ pub unsafe trait HasDelayedWork= : HasWork {} =20 /// Used to safely implement the [`HasDelayedWork`] trait. /// -/// This macro also implements the [`HasWork`] trait, so you do not need t= o use [`impl_has_work!`] -/// when using this macro. +/// This macro also implements the [`HasWork`] trait, so you do not need t= o use `#[has_field]` when +/// using this macro. /// /// # Examples /// --=20 2.50.1 (Apple Git-155)