Subject: [PATCH 6.8 134/228] rust: phy: implement `Send` for `Registration`

From: Greg Kroah-Hartman <[email-masked]>
Date: Tue, 30 Apr 2024 12:38:32 +0200

6.8-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wedson Almeida Filho <[email-masked]>

commit df70d04d56975f527b9c965322cf56e245909071 upstream.

In preparation for requiring `Send` for `Module` implementations in the
next patch.

Cc: FUJITA Tomonori <[email-masked]>
Cc: Trevor Gross <[email-masked]>
Cc: [email-masked]
Signed-off-by: Wedson Almeida Filho <[email-masked]>
Reviewed-by: Alice Ryhl <[email-masked]>
Link: https://lore.kernel.org/r/[email-masked]
Signed-off-by: Miguel Ojeda <[email-masked]>
Signed-off-by: Greg Kroah-Hartman <[email-masked]>
---
 rust/kernel/net/phy.rs |    4 ++++
 1 file changed, 4 insertions(+)

--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -640,6 +640,10 @@ pub struct Registration {
     drivers: Pin<&'static mut [DriverVTable]>,
 }
 
+// SAFETY: The only action allowed in a `Registration` instance is dropping it, which is safe to do
+// from any thread because `phy_drivers_unregister` can be called from any thread context.
+unsafe impl Send for Registration {}
+
 impl Registration {
     /// Registers a PHY driver.
     pub fn register(