diff options
| author | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2024-08-28 07:35:15 +0000 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2024-08-30 10:27:35 +0100 |
| commit | 5114e05a3cfa61c2ea20fa2e223a8e519aa163e4 (patch) | |
| tree | 28ad7cec64185a7a4b58902aea04c5e0b32fb5be /rust/kernel/net/phy.rs | |
| parent | b2e47002b2350f57bfa8fe1c231e9fbb6baef78b (diff) | |
rust: net::phy unified genphy_read_status function for C22 and C45 registers
Add unified genphy_read_status function for C22 and C45
registers. Instead of having genphy_c22 and genphy_c45 methods, this
unifies genphy_read_status functions for C22 and C45.
Reviewed-by: Trevor Gross <tmgross@umich.edu>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'rust/kernel/net/phy.rs')
| -rw-r--r-- | rust/kernel/net/phy.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index 45866db14c76..1d47884aa3cf 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -252,16 +252,8 @@ impl Device { } /// Checks the link status and updates current link state. - pub fn genphy_read_status(&mut self) -> Result<u16> { - let phydev = self.0.get(); - // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. - // So it's just an FFI call. - let ret = unsafe { bindings::genphy_read_status(phydev) }; - if ret < 0 { - Err(Error::from_errno(ret)) - } else { - Ok(ret as u16) - } + pub fn genphy_read_status<R: reg::Register>(&mut self) -> Result<u16> { + R::read_status(self) } /// Updates the link status. |
