[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250625-correct-type-cast-v2-2-6f2c29729e69@gmail.com>
Date: Wed, 25 Jun 2025 05:25:39 -0700
From: Tamir Duberstein <tamird@...il.com>
To: FUJITA Tomonori <fujita.tomonori@...il.com>,
Trevor Gross <tmgross@...ch.edu>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Danilo Krummrich <dakr@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, Tamir Duberstein <tamird@...il.com>
Subject: [PATCH net-next v2 2/2] Cast to the proper type
Use the ffi type rather than the resolved underlying type.
Acked-by: FUJITA Tomonori <fujita.tomonori@...il.com>
Signed-off-by: Tamir Duberstein <tamird@...il.com>
---
rust/kernel/net/phy.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index 9b4dc09403e4..5fa6b7e97887 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -163,20 +163,20 @@ pub fn set_speed(&mut self, speed: u32) {
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.
--
2.50.0
Powered by blists - more mailing lists