diff options
author | Grant Likely <grant.likely@linaro.org> | 2014-02-18 16:38:55 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@linaro.org> | 2014-02-20 06:52:09 -0500 |
commit | 1f42e5dd5065963979bb53daadf5d4f1e71f0c5f (patch) | |
tree | 8a816a351c009f02389740e4a1db1aa05570b376 /drivers/of/testcase-data | |
parent | b5190516b282bee6f10569c3387d16f83447d280 (diff) |
of: Add self test for of_match_node()
Adds a selftest function for the of_match_node function. of_match_node
is supposed to handle precedence for the compatible property as well as
the name and device_type values. This patch adds some test case data and
a function that makes sure each test node matches against the correct
entry of an of_device_id table.
This code was written to verify the new of_match_node() implementation
that is an earlier part of this series.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Kevin Hao <haokexin@gmail.com>
Diffstat (limited to 'drivers/of/testcase-data')
-rw-r--r-- | drivers/of/testcase-data/testcases.dtsi | 1 | ||||
-rw-r--r-- | drivers/of/testcase-data/tests-match.dtsi | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/of/testcase-data/testcases.dtsi b/drivers/of/testcase-data/testcases.dtsi index 3cc2f55534ac..3a5b75a8e4d7 100644 --- a/drivers/of/testcase-data/testcases.dtsi +++ b/drivers/of/testcase-data/testcases.dtsi | |||
@@ -1,2 +1,3 @@ | |||
1 | #include "tests-phandle.dtsi" | 1 | #include "tests-phandle.dtsi" |
2 | #include "tests-interrupts.dtsi" | 2 | #include "tests-interrupts.dtsi" |
3 | #include "tests-match.dtsi" | ||
diff --git a/drivers/of/testcase-data/tests-match.dtsi b/drivers/of/testcase-data/tests-match.dtsi new file mode 100644 index 000000000000..c9e541129534 --- /dev/null +++ b/drivers/of/testcase-data/tests-match.dtsi | |||
@@ -0,0 +1,19 @@ | |||
1 | |||
2 | / { | ||
3 | testcase-data { | ||
4 | match-node { | ||
5 | name0 { }; | ||
6 | name1 { device_type = "type1"; }; | ||
7 | a { name2 { device_type = "type1"; }; }; | ||
8 | b { name2 { }; }; | ||
9 | c { name2 { device_type = "type2"; }; }; | ||
10 | name3 { compatible = "compat3"; }; | ||
11 | name4 { compatible = "compat2", "compat3"; }; | ||
12 | name5 { compatible = "compat2", "compat3"; }; | ||
13 | name6 { compatible = "compat1", "compat2", "compat3"; }; | ||
14 | name7 { compatible = "compat2"; device_type = "type1"; }; | ||
15 | name8 { compatible = "compat2"; device_type = "type1"; }; | ||
16 | name9 { compatible = "compat2"; }; | ||
17 | }; | ||
18 | }; | ||
19 | }; | ||