of_parse_phandle_with_args — find a node pointed to by phandle in a list
int of_parse_phandle_with_args ( | const struct device_node * np, |
const char * list_name, | |
const char * cells_name, | |
int index, | |
struct of_phandle_args * out_args) ; |
np
Pointer to node that contains the phandle list
list_name
Name of property that contains the phandle list
cells_name
Name of property in target node that contains phandle's argument count
index
Index into the phandle list
out_args
If not NULL, pointer used to return the device_node pointer and the phandle arguments.
Resolve a phandle to a device node pointer.
The phandle is an element of the property list_name in node np.
Index specifies which element of property list_name contains the desired phandle. Index is zero-based. The size of each element of the list is not constant (see cells_name).
For each phandle in list_name, the target device_node will be searched for the property cells_name, to determine how many arguments follow the phandle in list_name.
The device_node pointer will be returned in out_args->np. The associated phandle arguments will be returned in out_args->args[].
The caller is responsible to call of_node_put
on the returned out_args->np
pointer when done.
Example
'phandle1: node1 { #list-cells = <2>; }'
'phandle2: node2 { #list-cells = <1>; }'
'node3 { list = <phandle1 1 2 phandle2 3>; }'
To get the 'node2' device_node pointer you may call this: of_parse_phandle_with_args(node3, “list”, “#list-cells”, 1, args);