fwnode_mdio_find_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

okay so this is fwnode_mdio_find_device β€” it's in the Kernel API Manual, and what it does is: you hand it a fwnode, and it finds you the mdio_device. that's literally it, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

struct mdio_device * fwnode_mdio_find_device (struct fwnode_handle
*fwnode );

like, yes, it wraps across two lines. that's just how the manpage formatting ate it. she's still iconic 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • fwnode β€” pointer to the mdio_device's fwnode. that's the thing you're searching by, bestie ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, and you need to actually listen to this part:

if it goes well, it returns a pointer to the mdio_device β€” and listen πŸ‘ the embedded struct device refcount gets incremented by one. so you are now holding a reference, and it is yours to deal with. it can also return NULL on failure, which is the sad path, no cap 😭

🚨 and because the refcount got bumped, the caller should call put_device on the mdio_device after its use. this is not optional garnish, this is the whole deal. you found it, you increment it, you release it. periodt πŸ’…

πŸ’– SEE ALSO πŸ’–

the kernel file is ./drivers/net/phy/phy_device.c and honestly it has SO many friends, look at this lineup πŸ”₯

like… the friend group is huge and every single one of them is a (9). iykyk 🌸


and that's the page, bestie πŸ’œ this one lives in ./drivers/net/phy, it's the October 2026 version, and it's filed under fwnode_mdio_find_device(9). go forth, find your device, and please remember the put_device. mwah πŸ˜˜πŸŽ€

πŸ“¦ where this page comes from