Skip to content

Commit 87880a7

Browse files
wedsonafSasha Levin
authored and
Sasha Levin
committed
rust: phy: implement Send for Registration
commit df70d04 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1351ac9 commit 87880a7

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)