of_mdio_find_device(9)
π of_mdio_find_device(9) π
okay bestie, welcome to the Kernel API Manual β¨ this one's a lil lookup function and honestly it's giving "short but powerful" energy. let's get into it π
πΈ NAME πΈ
of_mdio_find_device β given a device tree node, find the mdio_device π¦
like, you hand it a node, it hands you back the mdio_device. matchmaker behaviour, honestly π
β¨ SYNOPSIS β¨
struct mdio_device * of_mdio_find_device (struct device_node *np );
yes that's the whole thing, no cap π₯
π«Ά ARGUMENTS π«Ά
npβ pointer to themdio_device's device tree node π this is the thing you're searching by, so make sure it's the right node bestie, iykyk
π DESCRIPTION π
so here's the vibe check π if it works, it returns a pointer to the mdio_device β and the embedded struct device refcount gets incremented by one β (yes, that part matters, that's the whole "who owns this memory" situation).
if it fails? you get NULL. that's it, no drama, no error code, just NULL π
β οΈ important bestie: the caller should callput_deviceon themdio_deviceafter its use. like, you gotta give the ref back. don't just wander off with it, that's not main character energy, that's a leak π
π SEE ALSO π
- Kernel file
./drivers/net/mdio/of_mdio.cπ __of_mdiobus_register(9)of_phy_find_device(9)of_phy_connect(9)of_phy_get_and_connect(9)
all the sibling functions, go read 'em, they slay too π
and that's the whole page, bestie!! π§ mwah π this one came to you from ./drivers/net/mdio, dated October 2026, and yeah β it's still of_mdio_find_device(9), iconic as ever ππ
π¦ 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