From nobody Sun Apr 5 18:19:06 2026 Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) (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 AC89A2ED15D for ; Tue, 24 Mar 2026 20:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774382569; cv=none; b=lnhcmULR1VEIytZtHn0MH7uZcx2IspThaEkw4xaD0Z6/4WZYeEVP1BkY6NpyKXDAk9z1GZx4U8y7b4UaUbOo6l5Zfg+pZXo9J61aoffZgMUP2aOrvaB8Sp7j8lSfNU1B9m1YLMv5VGz2qNchMctyqjRY/J9aAq2GAex598u2MKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774382569; c=relaxed/simple; bh=+Goy4D64nuP+BbSnhf7OhMpniV+yBTmRzYy1fAklWlE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QyRV1jUcISiOOLP2/MqsgDqrwfKkqAfrIkF/k/0HoiRTIJC4rOs7nXRNxjoIBPYw5/XOqfqKo2MsW1kIc+oIk9XkQyAJVmA3Lzzjw9+kzmlLt7Y+sPngPsDqYtcsuKdTpgNVcckmzmicjekQSdjpUp7ukU08Pmcnk/TEQIlkp/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cUX0jcEH; arc=none smtp.client-ip=209.85.208.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cUX0jcEH" Received: by mail-ed1-f73.google.com with SMTP id 4fb4d7f45d1cf-66952b873a0so2814894a12.1 for ; Tue, 24 Mar 2026 13:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774382566; x=1774987366; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=K1UbzXXxdNCI8P0ffOKTyNxYTiEdwXYX6YILJ8CGqb4=; b=cUX0jcEHyfrPklEKLVaSFKKchh/3BUFITyxxjgk1jSRnOE2V1v91jWCpvBqm9nr38q 9RcdohGaiLn4jrzEPsKQpgiqR9UIQDflbBxm9MBv6YMho5oUkoAlNuLjmMZOnNmvvQRz TZ2XL/rDCGwAsVMDJzEnrXV+5zBYC/kMy+7v0Q7FgdzL2jAmDFVYMKcznsc/h+G8qrIr B6QUyn8DZvmZAFvj7QKTvNwjqqMjGDviZpzNwmdzbBYVJW7dfmKNTYlynP+Mv53rS+P0 s7gW2JQhiTiJCuEP5SQ/ftio/5h2BAhn7xhWCfnQwb3ZTskiX+15JdyXsK7CpLHhwpCD 1Ipg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774382566; x=1774987366; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=K1UbzXXxdNCI8P0ffOKTyNxYTiEdwXYX6YILJ8CGqb4=; b=e93ImTMB+F0oz5eCtG01yc0yJnG4LUerdPzuAjFmrrkhIDiXMXUTGx3PzsVv5o387s l5O2/ZvHLCWj/Yf1aeWLo1TS3YBZp+tQ+CorpFC12nRZ8Lr9obgtO6FxF2+xITmAXOSG Skj6bgT/4+VeC7+oBgYytxng237XsGzitRKbNLLo2a9RPBBF7HBLhxMi5TMai6ve/PEH KiNYMVxdco2xaH/up0p7Cm0enNcHNvHH5g3Eh93OonZQ7yrVaPLLyLVobljz9TcPc4Gj HanENgEVD4BGaRbMzhlL28mQuqgRMsMLiNVOZfXbeCNwKRp73ioMIbeYlp6phAKSItcY YfkA== X-Forwarded-Encrypted: i=1; AJvYcCWhZYyNRtxfELvvTusBrLLKZdr031DZmTfZ5+3rcSGkPZQIJqvL+sflLyxh/KGqo0FKOyxKMUov2UlTzpc=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0JFzwCsDBVPytK74EI8iZgXUTC3xs0OVW4sHmsivKdH2DZ1HN k1AJT9zhHbBzk6zT6Ya0dpT3FpPWLa4ACuJKJZ6hbN6ucE+pE2v3NbhmY5xw6IIxPlGUHMlIcBI CXewmS2jHxG7/WTDnqw== X-Received: from edi11.prod.google.com ([2002:a05:6402:304b:b0:668:4fa5:f392]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6402:34d4:b0:66a:50c2:6bd6 with SMTP id 4fb4d7f45d1cf-66a826bd59amr376521a12.23.1774382565851; Tue, 24 Mar 2026 13:02:45 -0700 (PDT) Date: Tue, 24 Mar 2026 20:02:35 +0000 In-Reply-To: <20260324-close-fd-check-current-v3-0-b94274bedac7@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260324-close-fd-check-current-v3-0-b94274bedac7@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=1341; i=aliceryhl@google.com; h=from:subject:message-id; bh=+Goy4D64nuP+BbSnhf7OhMpniV+yBTmRzYy1fAklWlE=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBpwu3jwfsxkArEc4b6yvmEdSGyMepeXIO0IZSUf 971f3ft1AaJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCacLt4wAKCRAEWL7uWMY5 RnROEACer8y9e1AX57xRlq+4getDONYDY0NmA48HXkPrAUVJilmcAUhbgwSpvBSnYjkw9N03+/0 Vwra4T7rlL15qR8hRCEu1B7dDd3olIvjUMQtVRNsKmpauY7bJOVG+ukZqpgKLy3xuvAtIIuZ3MK dYY74dqjXVMlKM/Tr5R0pY3h4JsPGcPqT1ofE+QXaUjdv2xR3NUV7pnfLgtGJPqDqtqQZAT8ffu aa4F1zBQm95mH9KVgNpDjqrdUA/9q6RYtOwbPhL2IqCi9zV9ecITVGD2nhV0IKgWs5RsJeEl7JS b5rtpwhPnftqlA7T1oYOM4JNX+1Er+weiyJkAPrfZZrIdR/3C9uO8/lRXqfY9/FC6M85LDx9957 maC6i6vO/1/HPHailqG75DpruvGw50me9XuGDw2/i81QBblJrjO5czR5jpfE2rwkkueQIf6Zfn/ ffIrXjvZe3F6Uh5vveWxp35KmTZKDr4IsZEHF+vKLKh+hlDoEPfCPHKcyHpt641yxsh9omjtXpx SgWSorsjZ0A6S2iWHALxM55yUFRsbwnTizYIRetC+7u9MbfNPbUxn+U2bH/RMi1NzDb2zJBMLeM dad1HP3CAWRYxvP3IKtZEfSQrb5WCRf5xD+Gmbh1cutysDt42gImD/m2SLVv6fvV6m9i73y+B+/ zjU6EonJvLaZAIQ== X-Mailer: b4 0.14.3 Message-ID: <20260324-close-fd-check-current-v3-1-b94274bedac7@google.com> Subject: [PATCH v3 1/4] rust: sync: implement == operator for ARef From: Alice Ryhl To: Greg Kroah-Hartman , Carlos Llamas , Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Rust Binder wants to perform a comparison between ARef and &Task, so define the =3D=3D operator for ARef<_> when compared with another ARef<_> or just a reference. The operator is implemented in terms of the same operator applied to the inner type. Note that PartialEq cannot be implemented because it would overlap with the impl for ARef. Reviewed-by: Gary Guo Signed-off-by: Alice Ryhl --- rust/kernel/sync/aref.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs index 0616c0353c2b..9989f56d0605 100644 --- a/rust/kernel/sync/aref.rs +++ b/rust/kernel/sync/aref.rs @@ -170,3 +170,25 @@ fn drop(&mut self) { unsafe { T::dec_ref(self.ptr) }; } } + +impl PartialEq> for ARef +where + T: AlwaysRefCounted + PartialEq, + U: AlwaysRefCounted, +{ + #[inline] + fn eq(&self, other: &ARef) -> bool { + T::eq(&**self, &**other) + } +} +impl Eq for ARef {} + +impl PartialEq<&'_ U> for ARef +where + T: AlwaysRefCounted + PartialEq, +{ + #[inline] + fn eq(&self, other: &&U) -> bool { + T::eq(&**self, other) + } +} --=20 2.53.0.1018.g2bb0e51243-goog