phy_select_page(9)
π
phy_select_page β so you found the phy_select_page(9) page in the Kernel API Manual
okay bestie, buckle up, because this one is short but the rules are real. This is the kernel API manual entry for phy_select_page, and it's lowkey giving "tiny function, big responsibility." π
β¨ NAME β¨
phy_select_page β grab the bus lock, save whatever page you were on, and switch to a new page. that's the whole gig. π
πΈ SYNOPSIS πΈ
int phy_select_page (struct phy_device *phydev , int page );
π¦ ARGUMENTS π¦
phydevβ a pointer to astruct phy_device. yes, the actual PHY device, not a vibe. pass the real one. β¨pageβ the page you want. your desired page. the page of your dreams. π«Ά
π DESCRIPTION π
okay so here's the tea β β this function does three things and you're gonna respect all three:
- It takes the MDIO bus lock so nobody else can mess with the bus while you're doing your thing. protection against concurrent access, no cap. π₯
- It saves the current PHY page so it's not lost forever (we love a backup plan).
- It sets the current page to the one you asked for.
On error it returns a negative errno. otherwise it returns the previous page number β which, yes, is exactly the thing you're gonna need later. π
β οΈ and here's the part that is NOT optional: phy_restore_page must always be called after this, irrespective of success or failure of this call. like, always. success? call it. failure? call it. it's giving "no matter what happens, you clean up." periodt. π
π SEE ALSO π
Kernel file ./drivers/net/phy/phy-core.c, plus a whole friend group of functions that want your attention:
phy_speed_to_str(9)phy_duplex_to_str(9)phy_rate_matching_to_str(9)phy_fix_phy_mode_for_mac_delays(9)phy_interface_num_ports(9)phy_set_max_speed(9)of_set_phy_timing_role(9)phy_resolve_aneg_pause(9)phy_resolve_aneg_linkmode(9)phy_check_downshift(9)__phy_read_mmd(9)phy_read_mmd(9)__phy_write_mmd(9)phy_write_mmd(9)phy_modify_changed(9)__phy_modify(9)phy_modify(9)__phy_modify_mmd_changed(9)phy_modify_mmd_changed(9)__phy_modify_mmd(9)phy_modify_mmd(9)phy_save_page(9)phy_restore_page(9)phy_read_paged(9)phy_write_paged(9)phy_modify_paged_changed(9)phy_modify_paged(9)
and that's the whole page, bestie β short, sweet, and absolutely not letting you forget that phy_restore_page call. π§π
π cute lil sign-off: this one lives in ./drivers/net/phy, dated October 2026, straight from the Kernel API Manual. go forth and lock your buses responsibly. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms