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, np); 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, "%pOFn", "dev"); in of_unittest_printf()
303 of_unittest_printf_one(np, "%2pOFn", "dev"); in of_unittest_printf()
304 of_unittest_printf_one(np, "%5pOFn", " dev"); in of_unittest_printf()
305 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
306 of_unittest_printf_one(np, "%pOFp", phandle_str); in of_unittest_printf()
307 of_unittest_printf_one(np, "%pOFP", "dev@100"); in of_unittest_printf()
308 of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC"); in of_unittest_printf()
309 of_unittest_printf_one(np, "%10pOFP", " dev@100"); in of_unittest_printf()
310 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
312 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
313 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
314 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
315 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
316 of_unittest_printf_one(np, "%pOFC", in of_unittest_printf()
322 struct device_node *np; member
328 struct device_node *np; in of_unittest_check_phandles() local
333 for_each_of_allnodes(np) { in of_unittest_check_phandles()
334 if (!np->phandle) in of_unittest_check_phandles()
337 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
338 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
340 np->phandle, nh->np, np); in of_unittest_check_phandles()
350 nh->np = np; in of_unittest_check_phandles()
351 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
366 struct device_node *np; in of_unittest_parse_phandle_with_args() local
370 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
371 if (!np) { in of_unittest_parse_phandle_with_args()
376 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
383 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
432 i, args.np, rc); in of_unittest_parse_phandle_with_args()
437 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
440 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
446 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
449 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
455 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
458 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
464 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
467 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
474 struct device_node *np, *p0, *p1, *p2, *p3; in of_unittest_parse_phandle_with_args_map() local
478 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
479 if (!np) { in of_unittest_parse_phandle_with_args_map()
508 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
515 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
522 passed &= (args.np == p1); in of_unittest_parse_phandle_with_args_map()
528 passed &= (args.np == p3); in of_unittest_parse_phandle_with_args_map()
539 passed &= (args.np == p0); in of_unittest_parse_phandle_with_args_map()
544 passed &= (args.np == p1); in of_unittest_parse_phandle_with_args_map()
550 passed &= (args.np == p0); in of_unittest_parse_phandle_with_args_map()
555 passed &= (args.np == p2); in of_unittest_parse_phandle_with_args_map()
568 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
573 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
579 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
585 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
591 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
599 struct device_node *np; in of_unittest_property_string() local
602 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
603 if (!np) { in of_unittest_property_string()
608 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
610 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
612 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
614 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
616 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
618 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
620 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
624 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
626 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
628 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
630 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
634 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
637 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
639 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
641 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
643 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
646 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
649 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
651 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
654 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
659 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
661 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
663 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
666 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
670 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
673 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
711 struct device_node *n1, *n2, *n21, *nchangeset, *nremove, *parent, *np; in of_unittest_changeset() local
772 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
774 of_node_put(np); in of_unittest_changeset()
784 struct device_node *np; in of_unittest_parse_interrupts() local
791 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
792 if (!np) { in of_unittest_parse_interrupts()
801 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
808 i, args.np, rc); in of_unittest_parse_interrupts()
810 of_node_put(np); in of_unittest_parse_interrupts()
812 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
813 if (!np) { in of_unittest_parse_interrupts()
822 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
854 i, args.np, rc); in of_unittest_parse_interrupts()
856 of_node_put(np); in of_unittest_parse_interrupts()
861 struct device_node *np; in of_unittest_parse_interrupts_extended() local
868 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
869 if (!np) { in of_unittest_parse_interrupts_extended()
878 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
928 i, args.np, rc); in of_unittest_parse_interrupts_extended()
930 of_node_put(np); in of_unittest_parse_interrupts_extended()
970 struct device_node *np; in of_unittest_match_node() local
975 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
976 if (!np) { in of_unittest_match_node()
982 match = of_match_node(match_node_table, np); in of_unittest_match_node()
1010 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1017 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1018 of_platform_default_populate(np, NULL, NULL); in of_unittest_platform_populate()
1021 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1022 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1031 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1032 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1039 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1040 unittest(np, "No testcase data in device tree\n"); in of_unittest_platform_populate()
1041 if (!np) in of_unittest_platform_populate()
1048 of_node_put(np); in of_unittest_platform_populate()
1051 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1062 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1063 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1071 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1079 of_node_put(np); in of_unittest_platform_populate()
1090 static void update_node_properties(struct device_node *np, in update_node_properties() argument
1098 for_each_child_of_node(np, child) in update_node_properties()
1118 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1125 np, prop->name); in update_node_properties()
1140 static void attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
1146 full_name = kasprintf(GFP_KERNEL, "%pOF", np); in attach_node_and_children()
1155 update_node_properties(np, dup); in attach_node_and_children()
1159 child = np->child; in attach_node_and_children()
1160 np->child = NULL; in attach_node_and_children()
1164 np->sibling = np->parent->child; in attach_node_and_children()
1165 np->parent->child = np; in attach_node_and_children()
1166 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
1169 __of_attach_node_sysfs(np); in attach_node_and_children()
1186 struct device_node *unittest_data_node, *np; in unittest_data_add() local
1228 for_each_of_allnodes(np) in unittest_data_add()
1229 __of_attach_node_sysfs(np); in unittest_data_add()
1237 np = unittest_data_node->child; in unittest_data_add()
1238 while (np) { in unittest_data_add()
1239 struct device_node *next = np->sibling; in unittest_data_add()
1241 np->parent = of_root; in unittest_data_add()
1242 attach_node_and_children(np); in unittest_data_add()
1243 np = next; in unittest_data_add()
1257 struct device_node *np = dev->of_node; in unittest_probe() local
1259 if (np == NULL) { in unittest_probe()
1265 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
1267 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1275 struct device_node *np = dev->of_node; in unittest_remove() local
1277 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
1298 struct device_node *np; in of_path_to_platform_device() local
1301 np = of_find_node_by_path(path); in of_path_to_platform_device()
1302 if (np == NULL) in of_path_to_platform_device()
1305 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
1306 of_node_put(np); in of_path_to_platform_device()
1326 struct device_node *np; in of_path_to_i2c_client() local
1329 np = of_find_node_by_path(path); in of_path_to_i2c_client()
1330 if (np == NULL) in of_path_to_i2c_client()
1333 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
1334 of_node_put(np); in of_path_to_i2c_client()
1834 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
1839 if (np == NULL) { in unittest_i2c_bus_probe()
1845 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
1878 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
1881 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
1905 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
1907 if (!np) { in unittest_i2c_dev_probe()
1912 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
1920 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
1922 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
1953 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
1957 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
1959 if (!np) { in unittest_i2c_mux_probe()
1965 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
1997 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
2000 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
2376 struct device_node *np; in of_unittest_overlay_high_level() local
2406 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2407 if (of_node_name_eq(np, "__local_fixups__")) { in of_unittest_overlay_high_level()
2408 *pprev = np->sibling; in of_unittest_overlay_high_level()
2411 pprev = &np->sibling; in of_unittest_overlay_high_level()
2419 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2420 if (of_node_name_eq(np, "__symbols__")) { in of_unittest_overlay_high_level()
2421 overlay_base_symbols = np; in of_unittest_overlay_high_level()
2422 *pprev = np->sibling; in of_unittest_overlay_high_level()
2425 pprev = &np->sibling; in of_unittest_overlay_high_level()
2429 for_each_child_of_node(overlay_base_root, np) { in of_unittest_overlay_high_level()
2432 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
2434 np); in of_unittest_overlay_high_level()
2448 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2449 np->parent = of_root; in of_unittest_overlay_high_level()
2453 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2454 last_sibling = np; in of_unittest_overlay_high_level()
2461 for_each_of_allnodes_from(overlay_base_root, np) in of_unittest_overlay_high_level()
2462 __of_attach_node_sysfs(np); in of_unittest_overlay_high_level()
2524 struct device_node *np; in of_unittest() local
2538 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
2539 if (!np) { in of_unittest()
2543 of_node_put(np); in of_unittest()