fdt_subnode_offset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fdt_subnode_offset β€” bestie's guide to the fdt_subnode_offset(9) page πŸŽ€

okay so this is a page from the Kernel API Manual bestie, and it's literally about finding one specific subnode inside a device tree blob. no cap, that's the whole plot. let's get into it πŸ¦‹


✨ NAME ✨

fdt_subnode_offset β€” find a subnode of a given node πŸ”Ž

like, you have a node, you want its child. that's it. that's the function. main character energy fr fr.


🌸 SYNOPSIS 🌸

int fdt_subnode_offset (const void *fdt , int parentoffset , const char *name );

she's giving very straightforward signature, ngl. three things in, one int out πŸ’œ


🫢 ARGUMENTS 🫢

  • fdt β€” pointer to the device tree blob 🌳 like, the whole tree, the vibe, the entire situation.
  • parentoffset β€” structure block offset of a node πŸ“ this is where you're starting from, your home base.
  • name β€” name of the subnode to locate 🏷️ the one you're looking for. the specific child. the one your heart wants.

πŸ’– DESCRIPTION πŸ’–

so fdt_subnode_offset finds a subnode of the node at structure block offset parentoffset with the given name. literally that. she looks at the node you pointed at, and she goes and finds the child with that name ✨

and here's the cute part β€” name may include a unit address, in which case fdt_subnode_offset will find the subnode with that unit address 🎯 OR the unit address may be omitted, in which case fdt_subnode_offset will find an arbitrary subnode whose name excluding unit address matches the given name 🎲

lowkey important: if you skip the unit address, you get an arbitrary matching subnode. not "the first one", not "the best one". arbitrary. so don't go assuming an order, bestie πŸ™ˆ

⭐ RETURN ⭐

here's the vibe check on what comes back:

  • structure block offset of the requested subnode (>=0), on success πŸŽ‰ slay, you found it.
  • -FDT_ERR_NOTFOUND, if the requested subnode does not exist 😭 it's not there. she looked. nothing.
  • -FDT_ERR_BADOFFSET, if parentoffset did not point to an FDT_BEGIN_NODE tag πŸ’€ you pointed at the wrong spot, that's on you.
  • -FDT_ERR_BADMAGIC, -FDT_ERR_BADVERSION, -FDT_ERR_BADSTATE, -FDT_ERR_BADSTRUCTURE, -FDT_ERR_TRUNCATED, standard meanings πŸ‘‘ these are the classics, they mean what they always mean.

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./scripts/dtc/libfdt/libfdt.h β€” and honestly the whole friend group is here, so let's do the roll call 🫢


and that's the page, bestie πŸ’œ courtesy of ./scripts/dtc/libfdt, dated October 2026 β€” go forth and find your subnodes, you've got this 🧚✨

πŸ“¦ where this page comes from