From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 A2801388363; Mon, 25 May 2026 20:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779741029; cv=none; b=OV7KMu6udn80XBmC/gmNIA/S+FhfLRXdUfmQBTGEJoIvHJ5+9AfZrAVCSGieYlDgQXIzX5HSIXVzE7JeEcG95XpUn0RM1gy9qAaxTTmufds4/YwB2azpKJs3trV6vm34Br8gaS2Y6eZxBqDEyXNgxtyn9aRaxehhUsRUs66s10Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779741029; c=relaxed/simple; bh=BC1h/IFGFPQBOYuZJnLBqh7aupaXZODluoDtPDcPPF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WyMIbVkDNM06BJX2F4cfl+aSL4hABTzZs4gIatFST6Pt3yCKKMSqdHmcrDfviiaulS0Pnp8H3q+4SeFrY8MAqsm+H3lqfE1hyrJQv8OrS5XpqvJ65EqMCGr8Mv9PLFjim7Df8E2ZODxqvcv8CWu8RP1cpzr6KhL+LwU4Uw62BLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d18Bmy4S; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d18Bmy4S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82EF71F000E9; Mon, 25 May 2026 20:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779741028; bh=mqdVjByct2ZDI65nBQw9txg9uw6/mNnafA68BwYf80c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=d18Bmy4SZ2CcTi/2slLXuKXSCKMsS6fpjL9bhhYrO1G56zfXslcsEcOYSNJxtSq24 vZGpEQ2rRFRdaINIz+ZejqMJTWT2z3d0gRHq6EIl63abhZrpwwMBy/fBs1EtfaCzfc qmdI2WQANPlye7Xet/MvlGvTEKMD0XywYvT0+/LCWeuRDzxRBoqR+7WHZlX74rONo9 w0f58QybvwE+q4dwii1RR6isNwD/SNxfMjdKx7OLtCac+9DSMnZOQG/SxUJwPPkWCm 5r991him+Hv9o6qyXTxQZ42yZmVa3woUe9xiULjEbVNiS7q/Y0idtPUZ1xwuXOQIXQ hp3BZfzMKY2yQ== From: Danilo Krummrich To: gregkh@linuxfoundation.org, rafael@kernel.org, acourbot@nvidia.com, aliceryhl@google.com, david.m.ertman@intel.com, ira.weiny@intel.com, leon@kernel.org, viresh.kumar@linaro.org, m.wilczynski@samsung.com, ukleinek@kernel.org, bhelgaas@google.com, kwilczynski@kernel.org, abdiel.janulgue@gmail.com, robin.murphy@arm.com, markus.probst@posteo.de, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, igor.korotin@linux.dev, daniel.almeida@collabora.com, pcolberg@redhat.com Cc: driver-core@lists.linux.dev, linux-kernel@vger.kernel.org, nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-pm@vger.kernel.org, linux-pwm@vger.kernel.org, linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org, Danilo Krummrich Subject: [PATCH v5 08/24] rust: auxiliary: implement Sync for Device Date: Mon, 25 May 2026 22:20:55 +0200 Message-ID: <20260525202921.124698-9-dakr@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260525202921.124698-1-dakr@kernel.org> References: <20260525202921.124698-1-dakr@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Implement Sync for Device in addition to Device. Device uses the same underlying struct auxiliary_device as Device; Bound is a zero-sized type-state marker that does not affect thread safety. This is needed for drivers to store &'bound auxiliary::Device in their private data while remaining Send. Reviewed-by: Alexandre Courbot Reviewed-by: Gary Guo Reviewed-by: Greg Kroah-Hartman Signed-off-by: Danilo Krummrich --- rust/kernel/auxiliary.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/kernel/auxiliary.rs b/rust/kernel/auxiliary.rs index 4e83f9e27d78..df2c97423dcc 100644 --- a/rust/kernel/auxiliary.rs +++ b/rust/kernel/auxiliary.rs @@ -369,6 +369,10 @@ unsafe impl Send for Device {} // (i.e. `Device) are thread safe. unsafe impl Sync for Device {} +// SAFETY: Same as `Device` -- the underlying `struct auxiliary_device` is the same; +// `Bound` is a zero-sized type-state marker that does not affect thread safety. +unsafe impl Sync for Device {} + /// Wrapper that stores a [`TypeId`] alongside the registration data for runtime type checking. #[repr(C)] #[pin_data] -- 2.54.0