Message ID | 20250319145350.69543-2-dakr@kernel.org (mailing list archive) |
---|---|
State | Handled Elsewhere |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [1/2] rust: pci: require Send for Driver trait implementers | expand |
On Wed Mar 19, 2025 at 3:52 PM CET, Danilo Krummrich wrote: > 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") > Reported-by: Alice Ryhl <aliceryhl@google.com> > Closes: https://lore.kernel.org/lkml/Z9rDxOJ2V2bPjj5i@google.com/ > Signed-off-by: Danilo Krummrich <dakr@kernel.org> Good catch Alice! Reviewed-by: Benno Lossin <benno.lossin@proton.me> --- Cheers, Benno > --- > rust/kernel/platform.rs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > 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:
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:
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") Reported-by: Alice Ryhl <aliceryhl@google.com> Closes: https://lore.kernel.org/lkml/Z9rDxOJ2V2bPjj5i@google.com/ Signed-off-by: Danilo Krummrich <dakr@kernel.org> --- rust/kernel/platform.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)