of_parse_pha...ith_args_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay bestie, this is the Kernel API Manual page for of_parse_phandle_with_args_map β€” the header abbreviates it as of_parse_pha...ith_args_map(9) because truncation is lowkey a lifestyle. It Find a node pointed by phandle in a list and remap it. No cap. πŸ’…


✨ SYNOPSIS ✨

int of_parse_phandle_with_args_map (const struct device_node *np , const char *list_name , const char *stem_name , int index , struct of_phandle_args *_out_args );

πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” pointer to a device tree node containing a list.
  • list_name β€” property name that contains a list.
  • stem_name β€” stem of property names that specify phandles' arguments count.
  • index β€” index of a phandle to parse out.
  • _out_args β€” optional pointer to output arguments structure (will be filled).

πŸ’… DESCRIPTION πŸ’…

okay so this function is useful to parse lists of phandles and their arguments. It’s giving β€œphandle list decoder, but make it remap-aware.” ✨

On success it returns 0 and fills _out_args; on error it returns the appropriate errno value. slay.

The difference between this function and of_parse_phandle_with_args is that this API remaps a phandle if the node the phandle points to has a <stem_name>-map property. That’s the whole plot twist, iykyk. πŸ¦‹

Caller is responsible to call of_node_put on the returned _out_args->np pointer. Don’t forget, bestie β€” that’s your cleanup era. 🫢

Example:

        phandle1: node1 {
            #list-cells = <2>;
        };

        phandle2: node2 {
            #list-cells = <1>;
        };

        phandle3: node3 {
            #list-cells = <1>;
            list-map = <0 phandle2 3>,
                       <1 phandle2 2>,
                       <2 phandle1 5 1>;
            list-map-mask = <0x3>;
        };

        node4 {
            list = <phandle1 1 2 phandle3 0>;
        };

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

of_parse_phandle_with_args(node4, "list", "list", 1, args);

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/of/base.c plus these SEE ALSO besties:


πŸ’– cute sign-off: source/version ./drivers/of, date October 2026, page of_parse_pha...ith_args_map(9) β€” periodt ✨🫢

πŸ“¦ where this page comes from