Lines Matching refs:np

50 	struct device_node *np;  in of_unittest_find_node_by_name()  local
53 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
54 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
55 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
57 of_node_put(np); in of_unittest_find_node_by_name()
61 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
62 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
64 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
65 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
66 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
68 of_node_put(np); in of_unittest_find_node_by_name()
71 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
72 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
73 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
75 of_node_put(np); in of_unittest_find_node_by_name()
79 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
80 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
82 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
83 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
84 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
86 of_node_put(np); in of_unittest_find_node_by_name()
89 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
90 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
91 of_node_put(np); in of_unittest_find_node_by_name()
93 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
94 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
95 of_node_put(np); in of_unittest_find_node_by_name()
97 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
98 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
99 of_node_put(np); in of_unittest_find_node_by_name()
101 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
102 unittest(np && !strcmp("testoption", options), in of_unittest_find_node_by_name()
104 of_node_put(np); in of_unittest_find_node_by_name()
106 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
107 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
109 of_node_put(np); in of_unittest_find_node_by_name()
111 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
112 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
114 of_node_put(np); in of_unittest_find_node_by_name()
116 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
117 unittest(np, "NULL option path test failed\n"); in of_unittest_find_node_by_name()
118 of_node_put(np); in of_unittest_find_node_by_name()
120 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
122 unittest(np && !strcmp("testaliasoption", options), in of_unittest_find_node_by_name()
124 of_node_put(np); in of_unittest_find_node_by_name()
126 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
128 unittest(np && !strcmp("test/alias/option", options), in of_unittest_find_node_by_name()
130 of_node_put(np); in of_unittest_find_node_by_name()
132 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
133 unittest(np, "NULL option alias path test failed\n"); in of_unittest_find_node_by_name()
134 of_node_put(np); in of_unittest_find_node_by_name()
137 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
138 unittest(np && !options, "option clearing test failed\n"); in of_unittest_find_node_by_name()
139 of_node_put(np); in of_unittest_find_node_by_name()
142 np = of_find_node_opts_by_path("/", &options); in of_unittest_find_node_by_name()
143 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
144 of_node_put(np); in of_unittest_find_node_by_name()
149 struct device_node *np; in of_unittest_dynamic() local
152 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
153 if (!np) { in of_unittest_dynamic()
169 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
176 unittest(of_add_property(np, prop) != 0, in of_unittest_dynamic()
182 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
190 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
194 unittest(of_remove_property(np, prop) == 0, in of_unittest_dynamic()
204 unittest(of_add_property(np, prop) == 0, in of_unittest_dynamic()
208 static int __init of_unittest_check_node_linkage(struct device_node *np) in of_unittest_check_node_linkage() argument
213 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
214 if (child->parent != np) { in of_unittest_check_node_linkage()
216 child->name, np->name); in of_unittest_check_node_linkage()
235 struct device_node *np; in of_unittest_check_tree_linkage() local
241 for_each_of_allnodes(np) in of_unittest_check_tree_linkage()
252 static void __init of_unittest_printf_one(struct device_node *np, const char *fmt, in of_unittest_printf_one() argument
266 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
278 snprintf(buf, size+1, fmt, np); in of_unittest_printf_one()
288 struct device_node *np; in of_unittest_printf() local
292 np = of_find_node_by_path(full_name); in of_unittest_printf()
293 if (!np) { in of_unittest_printf()
294 unittest(np, "testcase data missing\n"); in of_unittest_printf()
298 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
300 of_unittest_printf_one(np, "%pOF", full_name); in of_unittest_printf()
301 of_unittest_printf_one(np, "%pOFf", full_name); in of_unittest_printf()
302 of_unittest_printf_one(np, "%pOFp", phandle_str); in of_unittest_printf()
303 of_unittest_printf_one(np, "%pOFP", "dev@100"); in of_unittest_printf()
304 of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC"); in of_unittest_printf()
305 of_unittest_printf_one(np, "%10pOFP", " dev@100"); in of_unittest_printf()
306 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
308 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
309 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
310 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
311 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
312 of_unittest_printf_one(np, "%pOFC", in of_unittest_printf()
318 struct device_node *np; member
324 struct device_node *np; in of_unittest_check_phandles() local
329 for_each_of_allnodes(np) { in of_unittest_check_phandles()
330 if (!np->phandle) in of_unittest_check_phandles()
333 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
334 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
336 np->phandle, nh->np, np); in of_unittest_check_phandles()
346 nh->np = np; in of_unittest_check_phandles()
347 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
362 struct device_node *np; in of_unittest_parse_phandle_with_args() local
366 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
367 if (!np) { in of_unittest_parse_phandle_with_args()
372 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
378 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
427 i, args.np, rc); in of_unittest_parse_phandle_with_args()
431 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
434 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
439 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
442 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
447 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
450 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
455 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
458 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
465 struct device_node *np, *p0, *p1, *p2, *p3; in of_unittest_parse_phandle_with_args_map() local
469 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
470 if (!np) { in of_unittest_parse_phandle_with_args_map()
499 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
505 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
512 passed &= (args.np == p1); in of_unittest_parse_phandle_with_args_map()
518 passed &= (args.np == p3); in of_unittest_parse_phandle_with_args_map()
529 passed &= (args.np == p0); in of_unittest_parse_phandle_with_args_map()
534 passed &= (args.np == p1); in of_unittest_parse_phandle_with_args_map()
540 passed &= (args.np == p0); in of_unittest_parse_phandle_with_args_map()
545 passed &= (args.np == p2); in of_unittest_parse_phandle_with_args_map()
558 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
562 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
567 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
572 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
577 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
585 struct device_node *np; in of_unittest_property_string() local
588 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
589 if (!np) { in of_unittest_property_string()
594 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
596 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
598 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
600 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
602 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
604 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
606 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
610 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
612 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
614 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
616 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
620 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
623 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
625 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
627 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
629 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
632 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
635 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
637 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
640 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
645 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
647 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
649 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
652 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
656 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
659 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
697 struct device_node *n1, *n2, *n21, *nchangeset, *nremove, *parent, *np; in of_unittest_changeset() local
758 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
760 of_node_put(np); in of_unittest_changeset()
770 struct device_node *np; in of_unittest_parse_interrupts() local
777 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
778 if (!np) { in of_unittest_parse_interrupts()
787 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
794 i, args.np, rc); in of_unittest_parse_interrupts()
796 of_node_put(np); in of_unittest_parse_interrupts()
798 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
799 if (!np) { in of_unittest_parse_interrupts()
808 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
840 i, args.np, rc); in of_unittest_parse_interrupts()
842 of_node_put(np); in of_unittest_parse_interrupts()
847 struct device_node *np; in of_unittest_parse_interrupts_extended() local
854 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
855 if (!np) { in of_unittest_parse_interrupts_extended()
863 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
913 i, args.np, rc); in of_unittest_parse_interrupts_extended()
915 of_node_put(np); in of_unittest_parse_interrupts_extended()
955 struct device_node *np; in of_unittest_match_node() local
960 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
961 if (!np) { in of_unittest_match_node()
967 match = of_match_node(match_node_table, np); in of_unittest_match_node()
995 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1002 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1003 of_platform_default_populate(np, NULL, NULL); in of_unittest_platform_populate()
1006 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1007 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1016 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1017 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1024 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1025 unittest(np, "No testcase data in device tree\n"); in of_unittest_platform_populate()
1026 if (!np) in of_unittest_platform_populate()
1034 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1045 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1046 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1054 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1062 of_node_put(np); in of_unittest_platform_populate()
1073 static void update_node_properties(struct device_node *np, in update_node_properties() argument
1079 for_each_property_of_node(np, prop) in update_node_properties()
1082 for_each_child_of_node(np, child) in update_node_properties()
1092 static int attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
1098 full_name = kasprintf(GFP_KERNEL, "%pOF", np); in attach_node_and_children()
1102 update_node_properties(np, dup); in attach_node_and_children()
1106 child = np->child; in attach_node_and_children()
1107 np->child = NULL; in attach_node_and_children()
1111 np->sibling = np->parent->child; in attach_node_and_children()
1112 np->parent->child = np; in attach_node_and_children()
1113 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
1116 __of_attach_node_sysfs(np); in attach_node_and_children()
1135 struct device_node *unittest_data_node, *np; in unittest_data_add() local
1179 for_each_of_allnodes(np) in unittest_data_add()
1180 __of_attach_node_sysfs(np); in unittest_data_add()
1188 np = unittest_data_node->child; in unittest_data_add()
1189 while (np) { in unittest_data_add()
1190 struct device_node *next = np->sibling; in unittest_data_add()
1192 np->parent = of_root; in unittest_data_add()
1193 attach_node_and_children(np); in unittest_data_add()
1194 np = next; in unittest_data_add()
1208 struct device_node *np = dev->of_node; in unittest_probe() local
1210 if (np == NULL) { in unittest_probe()
1216 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
1218 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1226 struct device_node *np = dev->of_node; in unittest_remove() local
1228 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
1249 struct device_node *np; in of_path_to_platform_device() local
1252 np = of_find_node_by_path(path); in of_path_to_platform_device()
1253 if (np == NULL) in of_path_to_platform_device()
1256 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
1257 of_node_put(np); in of_path_to_platform_device()
1277 struct device_node *np; in of_path_to_i2c_client() local
1280 np = of_find_node_by_path(path); in of_path_to_i2c_client()
1281 if (np == NULL) in of_path_to_i2c_client()
1284 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
1285 of_node_put(np); in of_path_to_i2c_client()
1786 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
1791 if (np == NULL) { in unittest_i2c_bus_probe()
1797 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
1832 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
1835 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
1859 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
1861 if (!np) { in unittest_i2c_dev_probe()
1866 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
1874 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
1876 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
1907 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
1911 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
1913 if (!np) { in unittest_i2c_mux_probe()
1919 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
1951 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
1954 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
2307 struct device_node *np; in of_unittest_overlay_high_level() local
2337 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2338 if (!of_node_cmp(np->name, "__local_fixups__")) { in of_unittest_overlay_high_level()
2339 *pprev = np->sibling; in of_unittest_overlay_high_level()
2342 pprev = &np->sibling; in of_unittest_overlay_high_level()
2350 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2351 if (!of_node_cmp(np->name, "__symbols__")) { in of_unittest_overlay_high_level()
2352 overlay_base_symbols = np; in of_unittest_overlay_high_level()
2353 *pprev = np->sibling; in of_unittest_overlay_high_level()
2356 pprev = &np->sibling; in of_unittest_overlay_high_level()
2360 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2361 if (of_get_child_by_name(of_root, np->name)) { in of_unittest_overlay_high_level()
2363 np->name); in of_unittest_overlay_high_level()
2376 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2377 np->parent = of_root; in of_unittest_overlay_high_level()
2381 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2382 last_sibling = np; in of_unittest_overlay_high_level()
2389 for_each_of_allnodes_from(overlay_base_root, np) in of_unittest_overlay_high_level()
2390 __of_attach_node_sysfs(np); in of_unittest_overlay_high_level()
2446 struct device_node *np; in of_unittest() local
2456 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
2457 if (!np) { in of_unittest()
2461 of_node_put(np); in of_unittest()