of_parse_ph...ptional_args(9)
π 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:
of_node_init(9)of_machine_is_compatible(9)of_parse_phandle(9)of_parse_phandle_with_args(9)of_parse_phandle_with_fixed_args(9)of_phandle_args_equal(9)of_property_count_u8_elems(9)of_property_count_u16_elems(9)of_property_count_u32_elems(9)of_property_count_u64_elems(9)of_property_read_string_array(9)of_property_count_strings(9)of_property_read_string_index(9)of_property_present(9)of_property_read_u8_array(9)of_property_read_u16_array(9)of_property_read_u32_array(9)of_property_read_u64_array(9)struct of_changeset_entry(9)struct of_changeset(9)of_device_is_system_power_controller(9)of_have_populated_dt(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms