__mdiobus_read(9)
β¨ __mdiobus_read(9) β¨
okay so this is a page from the Kernel API Manual β yes, that manual β and today we're talking about __mdiobus_read, the unlocked version of the mdiobus_read function π
bestie, "unlocked" is doing a LOT of heavy lifting in that sentence, so stay with me.
πΈ SYNOPSIS πΈ
int __mdiobus_read (struct mii_bus *bus , int addr , u32 regnum );
like, that's the whole vibe. three args in, an int out. short and iconic π
π¦ ARGUMENTS π¦
busβ themii_busstruct, aka the whole MDIO bus situation you're working withaddrβ the phy address, i.e. which phy on the bus you're talking toregnumβ the register number to read, as au32
π RETURN π
if everything slays, you get the register value back β¨ if it doesn't, you get a negative error code β so like, check for that, don't just assume π
π DESCRIPTION π
so what does it actually do? it reads an MDIO bus register. that's it, that's the function π«Ά
but here's the part everyone forgets: the caller must hold the mdio bus lock. you. you hold the lock. this function is NOT gonna do it for you β that's literally the entire reason it's the __-prefixed one. no cap, that underscore prefix is a whole personality trait π
β οΈ NOTE β οΈ
MUST NOT be called from interrupt context. like, do not. not ever. this is not a drill, this is a rule π¨
π SEE ALSO π
kernel file ./drivers/net/phy/mdio_bus.c β go read it, iykyk π
__mdiobus_write(9)__mdiobus_modify_changed(9)__mdiobus_c45_read(9)__mdiobus_c45_write(9)__mdiobus_c45_modify_changed(9)mdiobus_read_nested(9)mdiobus_read(9)mdiobus_c45_read(9)mdiobus_c45_read_nested(9)mdiobus_write_nested(9)mdiobus_write(9)mdiobus_c45_write(9)mdiobus_c45_write_nested(9)mdiobus_modify(9)mdiobus_c45_modify(9)mdiobus_modify_changed(9)mdiobus_c45_modify_changed(9)
that's the whole friend group, fr fr π―ββοΈ
and that's the page!! tysm for reading bestie π₯° this little number lives in ./drivers/net/phy, dated October 2026, and it's filed under __mdiobus_read(9) β go hold that lock and stay out of interrupt context, mwah πβ¨
π¦ 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