Name

of_parse_phandle_with_fixed_args — find a node pointed by phandle in a list

Synopsis

int of_parse_phandle_with_fixed_args (const struct device_node * np,
 const char * list_name,
 int cell_count,
 int index,
 struct of_phandle_args * out_args);
 

Arguments

np

Pointer to node that contains the phandle list

list_name

Name of property in node np that contains the phandle list

cell_count

Number of argument cells following the phandle

index

Index into the phandle list

out_args

If not NULL, pointer used to return the device_node pointer and the phandle arguments.

Description

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 constant, cell_count specifies how many arguments follow each phandle.

The device_node pointer will be returned in out_args->np. The 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 { }'

'phandle2: node2 { }'

'node3 { list = <phandle1 0 2 phandle2 2 3>; }'

To get a device_node of the `node2' node you may call this: of_parse_phandle_with_fixed_args(node3, list, 2, 1, args);

Return

0 on success and fills out_args, -EINVAL if parsing error on list_name, -ENOENT if the entry specified by index does not exist.