mdiobus_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mdiobus_read πŸ’–

hey bestie!! welcome to the mdiobus_read(9) page from the Kernel API Manual β€” yes that manual, the one with the good stuff in it πŸŽ€ this one is basically a lil convenience wrapper for reading a given MII mgmt register and honestly? she's iconic for it ✨


🌸 SYNOPSIS 🌸

int mdiobus_read (struct mii_bus *bus , int addr , u32 regnum );

ok so three things go in, one int comes out, no cap πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • bus β€” the mii_bus struct, aka the bus you're doing all this on 🚌
  • addr β€” the phy address, like the little home address of the phy you're talking to 🏑
  • regnum β€” register number to read, the exact spot you're peeking at πŸ‘€

⭐ RETURN ⭐

The register value if successful, negative error code on failure 😭 so like... good vibes means you get your number back, bad vibes means negative error code, and you should fr fr check for that negative before you start celebrating 🫢


πŸ’€ NOTE πŸ’€

MUST NOT be called from interrupt context, because the bus read/write functions may wait for an interrupt to conclude the operation. 🚨

not me emphasizing this β€” it's literally in all caps in the original, so it's serious serious. interrupt context is not the vibe here, bestie. she needs to wait, and waiting inside an interrupt is a no πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

get into it, this whole friend group is listed under Kernel file ./drivers/net/phy/mdio_bus.c πŸ’œ

the way there are so many of them and every single one ate 😭 the C45 ones especially, iykyk 🌈


ok that's the whole page, go read your registers responsibly πŸ’–βœ¨

from ./drivers/net/phy, dated October 2026 β€” mwah, xoxo, your girl mdiobus_read(9) πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from