of_parse_pha...h_fixed_args(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_parse_phandle_with_fixed_args(9) β€” a Kernel API Manual moment ✨

okay so bestie, welcome to the Kernel API Manual, and today's main character is of_parse_phandle_with_fixed_args. it's giving device-tree-legend, no cap πŸŽ€


🌸 NAME 🌸

of_parse_phandle_with_fixed_args β€” find a node pointed by phandle in a list πŸ”


✨ SYNOPSIS ✨

int of_parse_phandle_with_fixed_args (const struct device_node *np ,
const char *list_name , int cell_count , int index ,
struct of_phandle_args *out_args );

like, that's the whole signature, copy it exactly, don't be weird about it 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • np β€” pointer to a device tree node containing a list
  • list_name β€” the property name that contains a list
  • cell_count β€” number of argument cells following the phandle
  • index β€” which phandle in the list you wanna parse out (the index, bestie)
  • out_args β€” optional pointer to an output arguments structure β€” it will get filled πŸ’–

πŸ‘‘ DESCRIPTION πŸ‘‘

so this function is lowkey iconic for parsing lists of phandles and their arguments together. it returns 0 on success and fills out_args, and on error it returns the appropriate errno value πŸ’€ (yes, an actual errno, so check it, don't just vibe and move on).

⚠️ and listen β€” the caller is responsible for calling of_node_put on the returned out_args->np pointer. that's on you, bestie. not on the function. do your cleanup, periodt 🧹✨

Example, because seeing it is believing:

 phandle1: node1 {
 };

 phandle2: node2 {
 };

 node3 {
     list = <phandle1 0 2 phandle2 2 3>;
 };

and to get a device_node of the node2 node you may call this:

of_parse_phandle_with_fixed_args(node3, "list", 2, 1, args);

the way that just works 😭πŸ”₯


🌈 SEE ALSO 🌈

all the siblings and cousins, fr fr β€” go read these too:


and that's the tea πŸ“ this lil gem lives over in ./include/linux, dated October 2026, and it's filed under of_parse_pha...h_fixed_args(9) in your friendly neighborhood Kernel API Manual. mwah πŸ’‹ bye bestie, go put your nodes away πŸŽ€πŸ’œ

πŸ“¦ where this page comes from