diff options
author | 2025-06-25 05:25:39 -0700 | |
---|---|---|
committer | 2025-07-01 09:49:18 +0200 | |
commit | c9a7bcd2c016ac814fd56e5a2b0946fb14960de4 (patch) | |
tree | 3c04b7964fe1f85b996d72eb9a329bb4f579caaf | |
parent | Use unqualified references to ffi types (diff) | |
download | wireguard-linux-c9a7bcd2c016ac814fd56e5a2b0946fb14960de4.tar.xz wireguard-linux-c9a7bcd2c016ac814fd56e5a2b0946fb14960de4.zip |
Cast to the proper type
Use the ffi type rather than the resolved underlying type.
Acked-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20250625-correct-type-cast-v2-2-6f2c29729e69@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | rust/kernel/net/phy.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index 0ea70b4c4ed9..b37de09651cb 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -163,20 +163,20 @@ impl Device { let phydev = self.0.get(); // SAFETY: The struct invariant ensures that we may access // this field without additional synchronization. - unsafe { (*phydev).speed = speed as i32 }; + unsafe { (*phydev).speed = speed as c_int }; } /// Sets duplex mode. pub fn set_duplex(&mut self, mode: DuplexMode) { let phydev = self.0.get(); let v = match mode { - DuplexMode::Full => bindings::DUPLEX_FULL as i32, - DuplexMode::Half => bindings::DUPLEX_HALF as i32, - DuplexMode::Unknown => bindings::DUPLEX_UNKNOWN as i32, + DuplexMode::Full => bindings::DUPLEX_FULL, + DuplexMode::Half => bindings::DUPLEX_HALF, + DuplexMode::Unknown => bindings::DUPLEX_UNKNOWN, }; // SAFETY: The struct invariant ensures that we may access // this field without additional synchronization. - unsafe { (*phydev).duplex = v }; + unsafe { (*phydev).duplex = v as c_int }; } /// Reads a PHY register. |