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 <fujita.tomonori@gmail.com> Cc: Trevor Gross <tmgross@umich.edu> Cc: netdev@vger.kernel.org Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20240328195457.225001-2-wedsonaf@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
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)