of_mdio_find_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 the mdio_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 call put_device on the mdio_device after 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 πŸ”

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