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 8CA9E378823; Thu, 21 May 2026 23:40:24 +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=1779406830; cv=none; b=Cp7N6XqZC8b/Dxpg+xth2MH2XM//RQiBumxskRQNx/k+SOSd3eQ5xEV72eZCF0OM0ULkKDoPeDHblM0Mb+YADYjOjK3WafsjhBvTTDloXst+rvk7+rU6RmiRKQNoMdhXtHfrK4cwlaSn3MLp7P8qH04vPf6lqMCLQ3cXrVCFXG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779406830; c=relaxed/simple; bh=JXccmOWpRcrxSO/NFM8G2pwnV88QKz/08Cw423hCPw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sxg5HeO5QU4tlk6/2KyCRG+UbC/DhYhyMV69+OWRtrFdIDjGd69T09J3J/zQtm/mkDVuSB0+GDfVfXpfU/r21L+DQ1tjCWdIPMGKMoLpvIcXlO+nh/oX16UgHNwHZLsMEpbrm14u+p50qytRf31fyyIShiAuL5WD1hKD5r1BJ1M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hs/9BRzA; 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="Hs/9BRzA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00F881F00A3C; Thu, 21 May 2026 23:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779406821; bh=e6xTb/0g7FVUv3sF33GAdUqdbfpeGXi2qCe2Zvc8fNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Hs/9BRzA8yHSFgq4PHMUssbNdcbHK7xdh8d8dTguIOsX9YHZsgRLHS48aORQNfBi6 jbkMqxIQDuSqBAYcRrl+/S0zKSEwH2ysmY7h9TGs/M8nE9AqMw8KpPbYiqNsbXcdqJ 9vthGbstXyD/R2uJvyhtq7xHzF+s4FUa7+FEk0gkOsXThInc1zMjSZTYvxGG1YLHAk k5sZH1jWO/sMBbooqd0xRk2W2yV01q3PkQVUZchsZ7eT6mhXqbqeK2gNOAjXRlUeiz WSV7wlVDlBN2n09uejGgzLsRugIsGtY0w0amifZKhtwmThNasBKW76woiVmtDC85ga Fi/1EH7mjBerg== 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 v4 09/27] rust: device: implement Sync for Device Date: Fri, 22 May 2026 01:34:35 +0200 Message-ID: <20260521233501.1191842-10-dakr@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260521233501.1191842-1-dakr@kernel.org> References: <20260521233501.1191842-1-dakr@kernel.org> Precedence: bulk X-Mailing-List: linux-pm@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 device as Device; Bound is a zero-sized type-state marker that does not affect thread safety. This is needed for types that hold &'bound Device, such as io::mem::IoMem, to be Send. Reviewed-by: Alexandre Courbot Reviewed-by: Gary Guo Signed-off-by: Danilo Krummrich --- rust/kernel/device.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs index 5df8fa108a52..c4486f4b8c40 100644 --- a/rust/kernel/device.rs +++ b/rust/kernel/device.rs @@ -467,6 +467,10 @@ unsafe impl Send for Device {} // synchronization in `struct device`. unsafe impl Sync for Device {} +// SAFETY: Same as `Device` -- the underlying `struct device` is the same; `Bound` is a +// zero-sized type-state marker that does not affect thread safety. +unsafe impl Sync for Device {} + /// Marker trait for the context or scope of a bus specific device. /// /// [`DeviceContext`] is a marker trait for types representing the context of a bus specific -- 2.54.0