From: Danilo Krummrich Date: Mon, 25 May 2026 20:20:54 +0000 (+0200) Subject: rust: platform: implement Sync for Device X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=a89111c00b68ff78cae7981a67601571e365d13b;p=thirdparty%2Flinux.git rust: platform: implement Sync for Device Implement Sync for Device in addition to Device. Device uses the same underlying struct platform_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 platform::Device in their private data while remaining Send. Reviewed-by: Alexandre Courbot Reviewed-by: Gary Guo Reviewed-by: Greg Kroah-Hartman Acked-by: Uwe Kleine-König Tested-by: Dirk Behme Link: https://patch.msgid.link/20260525202921.124698-8-dakr@kernel.org Signed-off-by: Danilo Krummrich --- diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs index 975b22ffe5dbf..106a5ed57ea62 100644 --- a/rust/kernel/platform.rs +++ b/rust/kernel/platform.rs @@ -565,3 +565,7 @@ unsafe impl Send for Device {} // SAFETY: `Device` can be shared among threads because all methods of `Device` // (i.e. `Device) are thread safe. unsafe impl Sync for Device {} + +// SAFETY: Same as `Device` -- 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 {}