of_count_phandle_with_args(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay so this is of_count_phandle_with_args, and it lives in the Kernel API Manual β€” iconic behavior, honestly. πŸ’…

The whole mission is to find the number of phandles references in a property. That’s the vibe: count the references, bestie. ✨


✨ SYNOPSIS ✨

int of_count_phandle_with_args (const struct device_node *np , const
       char *list_name , const char *cells_name );

πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” pointer to a device tree node containing a list. This is your home base for the list.
  • list_name β€” property name that contains a list. Basically the name of the property you’re checking.
  • cells_name β€” property name that specifies phandles’ arguments count. It tells you how many arguments are in the mix.

πŸ’– RETURN πŸ’–

It returns the number of phandle + argument tuples within a property. 🫢

It is a typical pattern to encode a list of phandle and variable arguments into a single property. The number of arguments is encoded by a property in the phandle-target node. For example, a gpios property would contain a list of GPIO specifies consisting of a phandle and 1 or more arguments. The number of arguments are determined by the #gpio-cells property in the node pointed to by the phandle. no cap. 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/of/base.c, plus the whole related-functions friend group:

mwah πŸ’‹ β€” source/version: ./drivers/of, date: October 2026.

πŸ“¦ where this page comes from