dev_or_parent_of_node(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 dev_or_parent_of_node β€” Kernel API Manual 🌸

okay so bestie, we're in the kernel API manual today, and this little function is genuinely one of the most "i got you" helpers out there πŸ’– it's dev_or_parent_of_node(9), and no cap, it does exactly what it says on the tin.


✨ NAME ✨

dev_or_parent_of_node β€” grab the device node of @dev, or of @dev's parent πŸŽ€

like. the name is the whole plot. slay.


πŸ¦‹ SYNOPSIS πŸ¦‹

struct device_node * dev_or_parent_of_node (struct device *dev );

one function, one argument, returns a struct device_node *. simple. iconic. periodt.


πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the device you want the device node of πŸ’… that's it, that's the whole arg. just hand over your dev and let the function cook.

πŸ‘‘ RETURN πŸ‘‘

so here's the vibe check on what you get back, and there are three whole possibilities, so listen up:

  • the device node pointer of dev β€” best case scenario, it just has one, congrats πŸŽ‰
  • the device node pointer of dev->parent β€” this is the "wait, if dev doesn't have a device node" fallback πŸ’« it climbs up one level to the parent, ngl that's the whole reason the function exists
  • NULL β€” the "neither dev or dev->parent have a device node" outcome 😭 no node, no parent node, no nothing. check for it, bestie, fr fr.

πŸ’œ SEE ALSO πŸ’œ

okay this part is a lot, but we do not skip, we do not cut, we list every single one. the kernel file in question is ./drivers/clk/clk.c, and here's the whole squad 🫢


and that's the whole page, bestie πŸ’… this one lives in ./drivers/clk, dated October 2026, and honestly? short, sweet, does its job. we love a low-maintenance icon πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from