of_parse_ph...ptional_args(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_parse_ph...ptional_args(9) β€” Kernel API Manual, bestie edition ✨

okay so this is a page straight out of the Kernel API Manual and it's about one little function that's doing the MOST to keep your device tree backwards-compatible 🫢


🌸 NAME 🌸

of_parse_phandle_with_optional_args β€” bestie, it literally finds a node pointed by a phandle in a list πŸ”πŸ’–


✨ SYNOPSIS ✨

int of_parse_phandle_with_optional_args (const struct device_node *np ,
const char *list_name , const char *cells_name , int index ,
struct of_phandle_args *out_args );

πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” pointer to a device tree node containing a list πŸ¦‹
  • list_name β€” the property name that contains a list πŸ“‹
  • cells_name β€” property name that specifies the phandles' arguments count, iykyk πŸ”’
  • index β€” which phandle in the list you wanna parse out πŸ‘‰
  • out_args β€” optional pointer to an output arguments structure (it will get filled, no cap) πŸ’«

πŸ’œ DESCRIPTION πŸ’œ

So it's the same as of_parse_phandle_with_args except β€” and this is the whole slay of it β€” if the cells_name property is not found, a cell_count of 0 is assumed. periodt. πŸ’…

It's genuinely useful when you've got a phandle that didn't have arguments before (so it has no #*-cells property, rip) but is now migrated to having arguments while retaining backwards compatibility. glow-up with zero breakage, we love to see it πŸŒˆπŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/of.h and honestly the whole friend group:


ngl the whole of_ squad showed up to this one 😭 it's giving family reunion

okay that's the whole page bestie, ily, go parse some phandles πŸ§šπŸ’–

β€” xoxo, sourced from ./include/linux, dated October 2026, still of_parse_ph...ptional_args(9) in spirit β­πŸ“

πŸ“¦ where this page comes from