Lines Matching refs:np
49 struct device_node *np; in of_unittest_find_node_by_name() local
52 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
53 unittest(np && !strcmp("/testcase-data", np->full_name), in of_unittest_find_node_by_name()
55 of_node_put(np); in of_unittest_find_node_by_name()
58 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
59 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
61 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
62 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), in of_unittest_find_node_by_name()
64 of_node_put(np); in of_unittest_find_node_by_name()
66 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
67 unittest(np && !strcmp("/testcase-data", np->full_name), in of_unittest_find_node_by_name()
69 of_node_put(np); in of_unittest_find_node_by_name()
72 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
73 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
75 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
76 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), in of_unittest_find_node_by_name()
78 of_node_put(np); in of_unittest_find_node_by_name()
80 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
81 unittest(!np, "non-existent path returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
82 of_node_put(np); in of_unittest_find_node_by_name()
84 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
85 unittest(!np, "non-existent alias returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
86 of_node_put(np); in of_unittest_find_node_by_name()
88 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
89 unittest(!np, "non-existent alias with relative path returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
90 of_node_put(np); in of_unittest_find_node_by_name()
92 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
93 unittest(np && !strcmp("testoption", options), in of_unittest_find_node_by_name()
95 of_node_put(np); in of_unittest_find_node_by_name()
97 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
98 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
100 of_node_put(np); in of_unittest_find_node_by_name()
102 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
103 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
105 of_node_put(np); in of_unittest_find_node_by_name()
107 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
108 unittest(np, "NULL option path test failed\n"); 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-alias:testaliasoption", in of_unittest_find_node_by_name()
113 unittest(np && !strcmp("testaliasoption", options), in of_unittest_find_node_by_name()
115 of_node_put(np); in of_unittest_find_node_by_name()
117 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
119 unittest(np && !strcmp("test/alias/option", options), in of_unittest_find_node_by_name()
121 of_node_put(np); in of_unittest_find_node_by_name()
123 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
124 unittest(np, "NULL option alias path test failed\n"); in of_unittest_find_node_by_name()
125 of_node_put(np); in of_unittest_find_node_by_name()
128 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
129 unittest(np && !options, "option clearing test failed\n"); in of_unittest_find_node_by_name()
130 of_node_put(np); in of_unittest_find_node_by_name()
133 np = of_find_node_opts_by_path("/", &options); in of_unittest_find_node_by_name()
134 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
135 of_node_put(np); in of_unittest_find_node_by_name()
140 struct device_node *np; in of_unittest_dynamic() local
143 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
144 if (!np) { in of_unittest_dynamic()
160 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
167 unittest(of_add_property(np, prop) != 0, in of_unittest_dynamic()
173 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
181 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
185 unittest(of_remove_property(np, prop) == 0, in of_unittest_dynamic()
195 unittest(of_add_property(np, prop) == 0, in of_unittest_dynamic()
199 static int __init of_unittest_check_node_linkage(struct device_node *np) in of_unittest_check_node_linkage() argument
204 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
205 if (child->parent != np) { in of_unittest_check_node_linkage()
207 child->name, np->name); in of_unittest_check_node_linkage()
226 struct device_node *np; in of_unittest_check_tree_linkage() local
232 for_each_of_allnodes(np) in of_unittest_check_tree_linkage()
245 struct device_node *np; member
251 struct device_node *np; in of_unittest_check_phandles() local
256 for_each_of_allnodes(np) { in of_unittest_check_phandles()
257 if (!np->phandle) in of_unittest_check_phandles()
260 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
261 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
263 np->phandle, nh->np->full_name, np->full_name); in of_unittest_check_phandles()
273 nh->np = np; in of_unittest_check_phandles()
274 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
289 struct device_node *np; in of_unittest_parse_phandle_with_args() local
293 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
294 if (!np) { in of_unittest_parse_phandle_with_args()
299 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
305 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
354 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args()
358 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
361 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
366 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
369 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
374 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
377 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
382 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
385 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
393 struct device_node *np; in of_unittest_property_string() local
396 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
397 if (!np) { in of_unittest_property_string()
402 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
404 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
406 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
408 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
410 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
412 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
414 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
418 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
420 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
422 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
424 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
428 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
431 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
433 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
435 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
437 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
440 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
443 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
445 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
448 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
453 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
455 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
457 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
460 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
464 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
467 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
502 struct device_node *n1, *n2, *n21, *nremove, *parent, *np; in of_unittest_changeset() local
538 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
540 of_node_put(np); in of_unittest_changeset()
552 struct device_node *np; in of_unittest_parse_interrupts() local
556 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
557 if (!np) { in of_unittest_parse_interrupts()
566 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
573 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
575 of_node_put(np); in of_unittest_parse_interrupts()
577 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
578 if (!np) { in of_unittest_parse_interrupts()
587 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
619 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
621 of_node_put(np); in of_unittest_parse_interrupts()
626 struct device_node *np; in of_unittest_parse_interrupts_extended() local
630 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
631 if (!np) { in of_unittest_parse_interrupts_extended()
639 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
689 i, args.np->full_name, rc); in of_unittest_parse_interrupts_extended()
691 of_node_put(np); in of_unittest_parse_interrupts_extended()
731 struct device_node *np; in of_unittest_match_node() local
736 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
737 if (!np) { in of_unittest_match_node()
743 match = of_match_node(match_node_table, np); in of_unittest_match_node()
766 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
773 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
774 of_platform_populate(np, of_default_bus_match_table, NULL, NULL); in of_unittest_platform_populate()
777 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
778 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
785 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
786 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
791 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
792 unittest(np, "No testcase data in device tree\n"); in of_unittest_platform_populate()
793 if (!np) in of_unittest_platform_populate()
801 test_bus->dev.of_node = np; in of_unittest_platform_populate()
803 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
804 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
812 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
820 of_node_put(np); in of_unittest_platform_populate()
831 static void update_node_properties(struct device_node *np, in update_node_properties() argument
837 for_each_property_of_node(np, prop) in update_node_properties()
840 for_each_child_of_node(np, child) in update_node_properties()
850 static int attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
855 dup = of_find_node_by_path(np->full_name); in attach_node_and_children()
857 update_node_properties(np, dup); in attach_node_and_children()
861 child = np->child; in attach_node_and_children()
862 np->child = NULL; in attach_node_and_children()
866 np->sibling = np->parent->child; in attach_node_and_children()
867 np->parent->child = np; in attach_node_and_children()
868 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
871 __of_attach_node_sysfs(np); in attach_node_and_children()
890 struct device_node *unittest_data_node, *np; in unittest_data_add() local
928 for_each_of_allnodes(np) in unittest_data_add()
929 __of_attach_node_sysfs(np); in unittest_data_add()
936 np = unittest_data_node->child; in unittest_data_add()
937 while (np) { in unittest_data_add()
938 struct device_node *next = np->sibling; in unittest_data_add()
940 np->parent = of_root; in unittest_data_add()
941 attach_node_and_children(np); in unittest_data_add()
942 np = next; in unittest_data_add()
952 struct device_node *np = dev->of_node; in unittest_probe() local
954 if (np == NULL) { in unittest_probe()
960 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_probe()
962 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
970 struct device_node *np = dev->of_node; in unittest_remove() local
972 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_remove()
993 struct device_node *np; in of_path_to_platform_device() local
996 np = of_find_node_by_path(path); in of_path_to_platform_device()
997 if (np == NULL) in of_path_to_platform_device()
1000 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
1001 of_node_put(np); in of_path_to_platform_device()
1021 struct device_node *np; in of_path_to_i2c_client() local
1024 np = of_find_node_by_path(path); in of_path_to_i2c_client()
1025 if (np == NULL) in of_path_to_i2c_client()
1028 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
1029 of_node_put(np); in of_path_to_i2c_client()
1173 struct device_node *np = NULL; in of_unittest_apply_overlay() local
1176 np = of_find_node_by_path(overlay_path(overlay_nr)); in of_unittest_apply_overlay()
1177 if (np == NULL) { in of_unittest_apply_overlay()
1184 ret = of_overlay_create(np); in of_unittest_apply_overlay()
1196 of_node_put(np); in of_unittest_apply_overlay()
1370 struct device_node *np; in of_unittest_overlay_6() local
1391 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_6()
1392 if (np == NULL) { in of_unittest_overlay_6()
1398 ret = of_overlay_create(np); in of_unittest_overlay_6()
1452 struct device_node *np; in of_unittest_overlay_8() local
1461 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_8()
1462 if (np == NULL) { in of_unittest_overlay_8()
1468 ret = of_overlay_create(np); in of_unittest_overlay_8()
1570 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
1575 if (np == NULL) { in unittest_i2c_bus_probe()
1581 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_probe()
1616 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
1619 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_remove()
1643 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
1645 if (!np) { in unittest_i2c_dev_probe()
1650 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_probe()
1658 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
1660 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_remove()
1697 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
1701 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_mux_probe()
1703 if (!np) { in unittest_i2c_mux_probe()
1709 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
1748 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
1752 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_mux_remove()
1931 struct device_node *np; in of_unittest() local
1941 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
1942 if (!np) { in of_unittest()
1946 of_node_put(np); in of_unittest()