fwnode_get_nth_parent(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ fwnode_get_nth_parent ✨

okay so real talk, this one lives in the Kernel API Manual, section 9, and it's lowkey one of the most useful little functions in the whole firmware-node friend group πŸ’…

🌸 NAME 🌸

fwnode_get_nth_parent β€” bestie, it literally returns an nth parent of a node. that's it. that's the function. πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

struct fwnode_handle * fwnode_get_nth_parent (struct fwnode_handle
*fwnode , unsigned int depth );

πŸ’– ARGUMENTS πŸ’–

  • fwnode β€” the node whose parent you're asking about πŸ‘‘ like, the main character here
  • depth β€” the distance of the parent from the node. so how many steps up the family tree you're climbing 🧚

🌈 DESCRIPTION 🌈

okay so this is the part where i have to be responsible for a sec πŸ™ˆ β€” the caller is responsible for calling fwnode_handle_put on the returned fwnode pointer. no cap, that's on you. don't be the person who forgets. it's giving leak energy and we are NOT about that πŸ’€

⭐ RETURN ⭐

it hands you back the nth parent of a node, periodt. ✨

  • if there's no parent at the requested depth, you get NULL back. sad but fair 😭
  • if depth is 0, the functionality is equivalent to fwnode_handle_get 🫢
  • for depth == 1, it's fwnode_get_parent and so on. the way it just scales, iconic honestly πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘

the kernel file ./drivers/base/property.c and honestly the whole extended fam β€” go say hi πŸ“:


ngl bestie, if you got all the way down here you're genuinely built different 🫢 now go call fwnode_handle_put, i'm begging 😭

and that's the whole page!! this one comes from ./drivers/base, dated October 2026, and yes it's fwnode_get_nth_parent(9) β€” mwah, slay, bye πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from