summaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorWedson Almeida Filho <walmeida@microsoft.com>2024-03-28 22:54:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-02 17:35:24 +0300
commitd09a4bf15b2c8a65e33b54eed2df2abe75d46f0e (patch)
tree796ff35dfb86df387b00b337a7561e57b98d5a94 /rust
parent585172ff4c63d6da7bc629e106e7a6583f229c6f (diff)
downloadlinux-d09a4bf15b2c8a65e33b54eed2df2abe75d46f0e.tar.xz
rust: phy: implement `Send` for `Registration`
commit df70d04d56975f527b9c965322cf56e245909071 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust')
-rw-r--r--rust/kernel/net/phy.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index e457b3c7cb2f..869797745b82 100644
--- 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(