phy_restore_page(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– phy_restore_page β€” the kernel API glow-up πŸ¦‹

okay so this is from the Kernel API Manual bestie, and it's literally the cleanup function you call after you've been messing with PHY pages. it puts the page register back and drops the bus lock. very "leave it how you found it" of her πŸ’…


✨ NAME ✨

phy_restore_page β€” restore the page register and release the bus lock πŸŽ€

🌸 SYNOPSIS 🌸

int phy_restore_page (struct phy_device *phydev , int oldpage , int ret );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • phydev β€” a pointer to a struct phy_device πŸ‘‘ like, the device in question.
  • oldpage β€” the old page 🎯 this is the return value from phy_save_page or phy_select_page, so don't just make one up.
  • ret β€” the operation's return code πŸ“‹ whatever the thing you were doing handed back.

πŸ’œ DESCRIPTION πŸ’œ

so what she does is release the MDIO bus lock, restoring oldpage if it's a valid page ✨ and yes she does both, she's a multi-tasker.

also important: this function propagates the earliest error code from the group of operations. so if something went wrong first, that's the error you're getting back. no cap πŸ™ˆ

🌈 RETURN 🌈

okay so the return value is a little priority list, pay attention bestie πŸ‘€:

  1. oldpage β€” if it was a negative value 😭
  2. otherwise ret β€” if it was a negative errno value
  3. otherwise phy_write_page's negative value β€” if it were in error
  4. otherwise ret 🫢

so like, first negative thing wins. that's the whole vibe check.

⭐ SEE ALSO ⭐

kernel file ./drivers/net/phy/phy-core.c β€” and omg the friend group is huge, here's everyone 🧚:


lowkey the whole phy_save_page β†’ phy_select_page β†’ phy_restore_page trio is giving main character energy. save, select, restore. iconic πŸ’…

and that's the page!! 🌸 from ./drivers/net/phy, dated October 2026, brought to you by the phy_restore_page(9) girlies β€” mwah, love u, go restore those pages responsibly πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from