From: Artem Lytkin <iprintercanon@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Trevor Gross <tmgross@umich.edu>,
Russell King <linux@armlinux.org.uk>,
Miguel Ojeda <ojeda@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org,
Artem Lytkin <iprintercanon@gmail.com>
Subject: [PATCH net-next 1/2] rust: net: phy: expose genphy_config_aneg()
Date: Mon, 23 Feb 2026 22:05:00 +0000 [thread overview]
Message-ID: <20260223220504.2102-2-iprintercanon@gmail.com> (raw)
In-Reply-To: <20260223220504.2102-1-iprintercanon@gmail.com>
Add genphy_config_aneg() method to phy::Device, wrapping the C
function __genphy_config_aneg(). This is needed by PHY drivers that
perform custom BMCR configuration before calling the generic
auto-negotiation setup.
The wrapper calls __genphy_config_aneg(phydev, false) directly since
genphy_config_aneg() is a static inline function not visible to
bindgen.
Signed-off-by: Artem Lytkin <iprintercanon@gmail.com>
---
rust/kernel/net/phy.rs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
index 3ca99db5cccf..5ccadc5e2579 100644
--- a/rust/kernel/net/phy.rs
+++ b/rust/kernel/net/phy.rs
@@ -276,6 +276,15 @@ pub fn genphy_read_abilities(&mut self) -> Result {
// So it's just an FFI call.
to_result(unsafe { bindings::genphy_read_abilities(phydev) })
}
+
+ /// Configures the advertisement and resets auto-negotiation
+ /// if auto-negotiation is enabled.
+ pub fn genphy_config_aneg(&mut self) -> Result {
+ 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.
+ to_result(unsafe { bindings::__genphy_config_aneg(phydev, false) })
+ }
}
impl AsRef<kernel::device::Device> for Device {
--
2.43.0
next prev parent reply other threads:[~2026-02-23 22:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 22:04 [PATCH net-next 0/2] net: phy: add Rust reference driver for ET1011C Artem Lytkin
2026-02-23 22:05 ` Artem Lytkin [this message]
2026-02-23 22:05 ` [PATCH v2 1/3] staging: most: dim2: replace IS_ERR_OR_NULL with IS_ERR for devm_clk_get Artem Lytkin
2026-02-24 0:25 ` Andrew Lunn
2026-02-23 22:05 ` [PATCH net-next 2/2] net: phy: add Rust reference driver for ET1011C Artem Lytkin
2026-02-24 0:37 ` Andrew Lunn
2026-02-23 22:05 ` [PATCH v2 2/3] staging: most: dim2: use dev_err_probe and proper error codes for clock Artem Lytkin
2026-02-24 4:32 ` [PATCH net-next v2 0/3] net: phy: add Rust reference driver for ET1011C Artem Lytkin
2026-02-24 4:32 ` [PATCH net-next v2 1/3] rust: net: phy: add speed() getter to Device Artem Lytkin
2026-02-24 4:32 ` [PATCH net-next v2 2/3] rust: net: phy: expose genphy_config_aneg() Artem Lytkin
2026-02-24 4:32 ` [PATCH net-next v2 3/3] net: phy: add Rust reference driver for ET1011C Artem Lytkin
2026-02-24 14:16 ` Andrew Lunn
2026-02-24 16:23 ` [PATCH net-next v2 0/3] " Miguel Ojeda
2026-02-24 16:49 ` [PATCH net-next v3 0/2] " Artem Lytkin
2026-02-24 16:49 ` [PATCH net-next v3 1/2] rust: net: phy: add speed() getter to Device Artem Lytkin
2026-02-24 16:49 ` [PATCH net-next v3 2/2] net: phy: add Rust reference driver for ET1011C Artem Lytkin
2026-02-24 17:04 ` Принтер Принтеров
2026-02-24 17:54 ` Miguel Ojeda
2026-02-24 18:09 ` Принтер Принтеров
2026-02-24 17:35 ` [PATCH net-next v3 0/2] " Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260223220504.2102-2-iprintercanon@gmail.com \
--to=iprintercanon@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fujita.tomonori@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=pabeni@redhat.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.