__mdiobus_write(9)
πΈ __mdiobus_write β Kernel API Manual, bestie edition πΈ
okay so you're in the kernel API manual, section 9, and the star of the show is __mdiobus_write. hi bestie, let's get into it π
β¨ NAME β¨
__mdiobus_write β the unlocked version of the mdiobus_write function. yes, the double underscore is doing main character work, it means "no lock, i trust you" π«Ά
β¨ SYNOPSIS β¨
int __mdiobus_write (struct mii_bus *bus , int addr , u32 regnum , u16
val );
like look at that signature. iconic. no notes π
β¨ ARGUMENTS β¨
busβ themii_busstruct, aka the whole vibe of the bus you're talking to πaddrβ the phy address, so the kernel knows which phy we're having a moment with πregnumβ register number to write, like the little mailbox slot π¬valβ the value to write toregnum, the actual tea being delivered β
β¨ RETURN β¨
Zero if successful β slay, zero means we ate π β and a negative error code on failure π (negative = the universe said no).
β¨ DESCRIPTION β¨
so basically you're writing a MDIO bus register. that's the whole thing. but here's the catch and it's a big one, bestie: the caller must hold the mdio bus lock. π
not "should". not "maybe". must. you're holding the lock, that's the deal. that's literally the entire reason this function exists separate from the locked one π
β¨ NOTE β¨
MUST NOT be called from interrupt context.
say it with me: MUST NOT. interrupt context is not the vibe for this one, fr fr. do not do it. π
β¨ SEE ALSO β¨
Kernel file ./drivers/net/phy/mdio_bus.c β that's where the source lives if you wanna go read the raw material π
and the whole friend group, no cap, all of them:
__mdiobus_read(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)
okay that's the whole page, go forth and hold that lock π
this lil drop came out of ./drivers/net/phy and it's stamped October 2026 β mwah, see u in the next release πβ¨
π¦ 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