mdiobus_c45_read_nested(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– mdiobus_c45_read_nested β€” like, the NESTED version of mdiobus_c45_read ✨

okay bestie, so this is straight out of the Kernel API Manual and it's genuinely so much less scary than the name makes it look 🫢 the name is mdiobus_c45_read_nested, and yes the (9) is part of the whole vibe, iykyk πŸ’…


✨ SYNOPSIS ✨

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

like… literally that's the whole signature, no cap πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • bus β€” the mii_bus struct, bestie. that's your bus babe 🌸
  • addr β€” the phy address, the little address of your phy ✨
  • devad β€” device address to read πŸ‘‘ (yes, c45 things get a device address, iconic)
  • regnum β€” register number to read πŸ’œ

🌈 RETURN 🌈

so if everything slays, you get the register value back πŸŽ€ and if it doesn't? you get a negative error code on failure 😭 that's it, that's the contract, fr fr.


πŸ”₯ DESCRIPTION πŸ”₯

okay so the whole point of this one: when you've got nested MDIO bus access, you use mutex_lock_nested so you avoid lockdep false positives ✨ that's literally the description, no extra lore, that's the tea πŸ’…

like lockdep was out here being dramatic and this function said "not today" πŸ’€


πŸ’€ NOTE πŸ’€

MUST NOT be called from interrupt context 🚨 and this is a hard MUST, not a soft little suggestion bestie!! the reason: 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 waiting on yourself, which is giving main character energy in the worst way πŸ˜­πŸ™ˆ don't do it!!

πŸŽ€ SEE ALSO πŸŽ€

all the siblings and cousins, in the kernel file ./drivers/net/phy/mdio_bus.c:


πŸ’– okay that's the whole page bestie, go forth and read your c45 registers safely πŸ’–

signing off from ./drivers/net/phy, dated October 2026, brought to you by the one and only mdiobus_c45_read_nested(9) 🌸🫢✨

πŸ“¦ where this page comes from