summaryrefslogtreecommitdiffstats
path: root/drivers/of/unittest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/unittest.c')
-rw-r--r--drivers/of/unittest.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 41b49716ac75..a3a6866765f2 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -212,8 +212,8 @@ static int __init of_unittest_check_node_linkage(struct device_node *np)
212 212
213 for_each_child_of_node(np, child) { 213 for_each_child_of_node(np, child) {
214 if (child->parent != np) { 214 if (child->parent != np) {
215 pr_err("Child node %s links to wrong parent %s\n", 215 pr_err("Child node %pOFn links to wrong parent %pOFn\n",
216 child->name, np->name); 216 child, np);
217 rc = -EINVAL; 217 rc = -EINVAL;
218 goto put_child; 218 goto put_child;
219 } 219 }
@@ -299,6 +299,10 @@ static void __init of_unittest_printf(void)
299 299
300 of_unittest_printf_one(np, "%pOF", full_name); 300 of_unittest_printf_one(np, "%pOF", full_name);
301 of_unittest_printf_one(np, "%pOFf", full_name); 301 of_unittest_printf_one(np, "%pOFf", full_name);
302 of_unittest_printf_one(np, "%pOFn", "dev");
303 of_unittest_printf_one(np, "%2pOFn", "dev");
304 of_unittest_printf_one(np, "%5pOFn", " dev");
305 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device");
302 of_unittest_printf_one(np, "%pOFp", phandle_str); 306 of_unittest_printf_one(np, "%pOFp", phandle_str);
303 of_unittest_printf_one(np, "%pOFP", "dev@100"); 307 of_unittest_printf_one(np, "%pOFP", "dev@100");
304 of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC"); 308 of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC");
@@ -1046,16 +1050,16 @@ static void __init of_unittest_platform_populate(void)
1046 for_each_child_of_node(np, child) { 1050 for_each_child_of_node(np, child) {
1047 for_each_child_of_node(child, grandchild) 1051 for_each_child_of_node(child, grandchild)
1048 unittest(of_find_device_by_node(grandchild), 1052 unittest(of_find_device_by_node(grandchild),
1049 "Could not create device for node '%s'\n", 1053 "Could not create device for node '%pOFn'\n",
1050 grandchild->name); 1054 grandchild);
1051 } 1055 }
1052 1056
1053 of_platform_depopulate(&test_bus->dev); 1057 of_platform_depopulate(&test_bus->dev);
1054 for_each_child_of_node(np, child) { 1058 for_each_child_of_node(np, child) {
1055 for_each_child_of_node(child, grandchild) 1059 for_each_child_of_node(child, grandchild)
1056 unittest(!of_find_device_by_node(grandchild), 1060 unittest(!of_find_device_by_node(grandchild),
1057 "device didn't get destroyed '%s'\n", 1061 "device didn't get destroyed '%pOFn'\n",
1058 grandchild->name); 1062 grandchild);
1059 } 1063 }
1060 1064
1061 platform_device_unregister(test_bus); 1065 platform_device_unregister(test_bus);
@@ -2357,11 +2361,14 @@ static __init void of_unittest_overlay_high_level(void)
2357 } 2361 }
2358 } 2362 }
2359 2363
2360 for (np = overlay_base_root->child; np; np = np->sibling) { 2364 for_each_child_of_node(overlay_base_root, np) {
2361 if (of_get_child_by_name(of_root, np->name)) { 2365 struct device_node *base_child;
2362 unittest(0, "illegal node name in overlay_base %s", 2366 for_each_child_of_node(of_root, base_child) {
2363 np->name); 2367 if (!strcmp(np->full_name, base_child->full_name)) {
2364 return; 2368 unittest(0, "illegal node name in overlay_base %pOFn",
2369 np);
2370 return;
2371 }
2365 } 2372 }
2366 } 2373 }
2367 2374