Name

of_match_device — Check if a struct device matches an of_device_id list

Synopsis

const struct of_device_id * of_match_device (const struct of_device_id * matches,
 const struct device * dev);
 

Arguments

matches

Array of device match structures to match against

dev

The of device structure to match against

Description

Used by a driver to check whether a platform_device is in its list of supported devices.

Get the best match in matches array for dev. 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.

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

Return

Pointer to the element of matches that provides the best match.