Messages in this thread Patch in this message |  | | From | Danilo Krummrich <> | | Subject | [PATCH 07/24] rust: platform: implement Sync for Device<Bound> | | Date | Tue, 28 Apr 2026 00:11:05 +0200 |
| |
Device<Bound> uses the same underlying struct platform_device as Device<Normal>; Bound is a zero-sized type-state marker that does not affect thread safety.
This is needed for drivers to store &'a platform::Device<Bound> in their HRT private data while remaining Send.
Signed-off-by: Danilo Krummrich <dakr@kernel.org> --- rust/kernel/platform.rs | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs index 1585b6a1ac45..ae648304eb5b 100644 --- a/rust/kernel/platform.rs +++ b/rust/kernel/platform.rs @@ -564,3 +564,7 @@ unsafe impl Send for Device {} // SAFETY: `Device` can be shared among threads because all methods of `Device` // (i.e. `Device<Normal>) are thread safe. unsafe impl Sync for Device {} + +// SAFETY: Same as `Device<Normal>` -- the underlying `struct platform_device` is the same; +// `Bound` is a zero-sized type-state marker that does not affect thread safety. +unsafe impl Sync for Device<device::Bound> {} -- 2.54.0
|  |