Skip to content

Commit df70d04

Browse files
wedsonafojeda
authored andcommitted
rust: phy: implement Send for Registration
In preparation for requiring `Send` for `Module` implementations in the next patch. Cc: FUJITA Tomonori <[email protected]> Cc: Trevor Gross <[email protected]> Cc: [email protected] Signed-off-by: Wedson Almeida Filho <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8933cf4 commit df70d04

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rust/kernel/net/phy.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,10 @@ pub struct Registration {
640640
drivers: Pin<&'static mut [DriverVTable]>,
641641
}
642642

643+
// SAFETY: The only action allowed in a `Registration` instance is dropping it, which is safe to do
644+
// from any thread because `phy_drivers_unregister` can be called from any thread context.
645+
unsafe impl Send for Registration {}
646+
643647
impl Registration {
644648
/// Registers a PHY driver.
645649
pub fn register(

0 commit comments

Comments
 (0)