diff options
author | Kevin Hao <haokexin@gmail.com> | 2014-02-19 12:15:45 +0400 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-02-20 15:50:58 +0400 |
commit | 215a14cface21ba205f6edc813be157fdf7899b8 (patch) | |
tree | 1dcd62060c2ca6f5698bfe08e618659a69b49c18 /scripts | |
parent | 71c5498eed06b5ac4325a525ed83aeed3e9a250a (diff) | |
download | linux-215a14cface21ba205f6edc813be157fdf7899b8.tar.xz |
of: reimplement the matching method for __of_match_node()
In the current implementation of __of_match_node(), it will compare
each given match entry against all the node's compatible strings
with of_device_is_compatible().
To achieve multiple compatible strings per node with ordering from
specific to generic, this requires given matches to be ordered from
specific to generic. For most of the drivers this is not true and
also an alphabetical ordering is more sane there.
Therefore, we define a following priority order for the match, and
then scan all the entries to find the best match.
1. specific compatible && type && name
2. specific compatible && type
3. specific compatible && name
4. specific compatible
5. general compatible && type && name
6. general compatible && type
7. general compatible && name
8. general compatible
9. type && name
10. type
11. name
v5: Fix nested locking bug
v4: Short-circuit failure cases instead of mucking with score, and
remove extra __of_device_is_compatible() wrapper stub.
Move scoring logic directly into __of_device_is_compatible()
v3: Also need to bail out when there does have a compatible member in match
entry, but it doesn't match with the device node's compatible.
v2: Fix the bug such as we get the same score for the following two match
entries with the empty node 'name2 { };'
struct of_device_id matches[] = {
{.name = "name2", },
{.name = "name2", .type = "type1", },
{}
};
Signed-off-by: Kevin Hao <haokexin@gmail.com>
[grant.likely: added v4 changes]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Tested-by: Stephen Chivers <schivers@csc.com>
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions