phy_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 phy_write(9) 🌸

okay bestie so this is a page straight out of the Kernel API Manual β€” the kernel's own little handbook β€” and it's all about one tiny but iconic function. Pull up a chair. 🫢


✨ NAME ✨

phy_write β€” the convenience function for writing to a given PHY register. that's it, that's the whole vibe. it writes a value to a register. lowkey the whole point of the function.


πŸŽ€ SYNOPSIS πŸŽ€

int phy_write (struct phy_device *phydev , u32 regnum , u16 val );

three little arguments, one int coming back at you. she's compact. she's efficient. she ate.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • phydev β€” the phy_device struct. this is your main character β€” the device object you're doing the writing on.
  • regnum β€” the register number to write. it's a u32, so pick your register and go πŸ’…
  • val β€” the value to write to regnum. it's a u16, and it's literally going into the register. girl's got a destination.

πŸ’€ NOTE πŸ’€

MUST NOT be called from interrupt context. not a suggestion, not a soft recommendation β€” MUST NOT. and the reason is so real: the bus read/write functions may wait for an interrupt to conclude the operation. so if you're already in interrupt context, you'd be out here waiting on an interrupt. 😭 do not do that to yourself.

periodt. no interrupt context. 🚫


🌈 SEE ALSO 🌈

the kernel file this all lives in is ./include/linux/phy.h, and here's the whole extended friend group β€” every single one of them, no gatekeeping πŸ’–

go read all of them. i'll wait. πŸ’œ


and that's the whole page, bestie!! this one shipped from ./include/linux and it's dated October 2026 β€” so yeah, future-dated kernel lore, we love to see it πŸ‘‘βœ¨ stay out of interrupt context and go write those registers responsibly πŸ’…πŸ’–

πŸ“¦ where this page comes from