summaryrefslogtreecommitdiffstats
path: root/rust/kernel/platform.rs
diff options
context:
space:
mode:
authorDanilo Krummrich <dakr@kernel.org>2025-03-19 15:52:56 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-20 07:41:11 -0700
commit51d0de7596a458096756c895cfed6bc4a7ecac10 (patch)
tree91b4f448e9ce79dc9dc137bf18fbd645fc5178b1 /rust/kernel/platform.rs
parent935e1d90bf6f14cd190b3a95f3cbf7e298123043 (diff)
downloadlinux-51d0de7596a458096756c895cfed6bc4a7ecac10.tar.gz
linux-51d0de7596a458096756c895cfed6bc4a7ecac10.tar.bz2
linux-51d0de7596a458096756c895cfed6bc4a7ecac10.zip
rust: platform: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback. Request implementers of the Driver trait to implement Send, since the remove() callback is not guaranteed to run from the same thread as probe(). Fixes: 683a63befc73 ("rust: platform: add basic platform device / driver abstractions") Cc: stable <stable@kernel.org> Reported-by: Alice Ryhl <aliceryhl@google.com> Closes: https://lore.kernel.org/lkml/Z9rDxOJ2V2bPjj5i@google.com/ Signed-off-by: Danilo Krummrich <dakr@kernel.org> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20250319145350.69543-2-dakr@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/kernel/platform.rs')
-rw-r--r--rust/kernel/platform.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs
index 2811ca53d8b6..e37531bae8e9 100644
--- a/rust/kernel/platform.rs
+++ b/rust/kernel/platform.rs
@@ -149,7 +149,7 @@ macro_rules! module_platform_driver {
/// }
/// }
///```
-pub trait Driver {
+pub trait Driver: Send {
/// The type holding driver private data about each device id supported by the driver.
///
/// TODO: Use associated_type_defaults once stabilized: