Name

of_find_matching_node_and_match — find node based on match table

Synopsis

struct device_node * of_find_matching_node_and_match (struct device_node * from,
 const struct of_device_id * matches,
 const struct of_device_id ** match);
 

Arguments

from

Pointer to node to start searching from or NULL for the entire device tree.

matches

Array of device match structures to search for

match

If not NULL, pointer used to return the element of matches which is the best match.

Description

Search the device tree for a node that matches an entry in the matches array. Each element of the matches array may specify any or all of compatible, type, or name. If name, type, or compatible in an element is not specified, it must be a string of length zero.

Set match to point to the element of matches that provides the best match.

The first string in the node's compatible property is the best match. Matching type is next best, followed by matching name. This results in the following priority order for matches

1. first string in the compatible property list && type && name

2. first string in the compatible property list && type

3. first string in the compatible property list && name

4. first string in the compatible property list

5. second string in the compatible property list && type && name

6. second string in the compatible property list && type

7. second string in the compatible property list && name

8. second string in the compatible property list

and so on up through the final string in the compatible property list. If the ordering of strings in the compatible is from the most specific to the least specific, as specified in the bindings standards, then the most specific compatible string is the best match.

If there is no match in the compatible property list, the priority order for matches is

1. type && name

2. type

3. name

From will not be searched, the search will begin with the next node in search order. Typical use is to pass what the previous call returned.

The order of the device tree traversal is kernel version specific.

of_node_put will be called on from.

Return

A node pointer with refcount incremented, use of_node_put on it when done. NULL if node is not found.