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()
222 struct device_node *np; in of_unittest_check_tree_linkage() local
228 for_each_of_allnodes(np) in of_unittest_check_tree_linkage()
241 struct device_node *np; member
247 struct device_node *np; in of_unittest_check_phandles() local
252 for_each_of_allnodes(np) { in of_unittest_check_phandles()
253 if (!np->phandle) in of_unittest_check_phandles()
256 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
257 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
259 np->phandle, nh->np->full_name, np->full_name); in of_unittest_check_phandles()
269 nh->np = np; in of_unittest_check_phandles()
270 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
285 struct device_node *np; in of_unittest_parse_phandle_with_args() local
289 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
290 if (!np) { in of_unittest_parse_phandle_with_args()
295 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
301 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
350 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args()
354 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
357 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
362 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
365 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
370 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
373 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
378 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
381 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
389 struct device_node *np; in of_unittest_property_string() local
392 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
393 if (!np) { in of_unittest_property_string()
398 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
400 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
402 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
404 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
406 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
408 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
410 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
414 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
416 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
418 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
420 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
424 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
427 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
429 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
431 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
433 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
436 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
439 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
441 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
444 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
449 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
451 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
453 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
456 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
460 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
463 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
498 struct device_node *n1, *n2, *n21, *nremove, *parent, *np; in of_unittest_changeset() local
534 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
536 of_node_put(np); in of_unittest_changeset()
548 struct device_node *np; in of_unittest_parse_interrupts() local
552 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
553 if (!np) { in of_unittest_parse_interrupts()
562 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
569 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
571 of_node_put(np); in of_unittest_parse_interrupts()
573 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
574 if (!np) { in of_unittest_parse_interrupts()
583 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
615 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
617 of_node_put(np); in of_unittest_parse_interrupts()
622 struct device_node *np; in of_unittest_parse_interrupts_extended() local
626 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
627 if (!np) { in of_unittest_parse_interrupts_extended()
635 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
685 i, args.np->full_name, rc); in of_unittest_parse_interrupts_extended()
687 of_node_put(np); in of_unittest_parse_interrupts_extended()
727 struct device_node *np; in of_unittest_match_node() local
732 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
733 if (!np) { in of_unittest_match_node()
739 match = of_match_node(match_node_table, np); in of_unittest_match_node()
762 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
769 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
770 of_platform_populate(np, of_default_bus_match_table, NULL, NULL); in of_unittest_platform_populate()
773 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
774 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
781 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
782 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
787 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
788 unittest(np, "No testcase data in device tree\n"); in of_unittest_platform_populate()
789 if (!np) in of_unittest_platform_populate()
797 test_bus->dev.of_node = np; in of_unittest_platform_populate()
799 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
800 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
808 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
816 of_node_put(np); in of_unittest_platform_populate()
827 static void update_node_properties(struct device_node *np, in update_node_properties() argument
833 for_each_property_of_node(np, prop) in update_node_properties()
836 for_each_child_of_node(np, child) in update_node_properties()
846 static int attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
851 dup = of_find_node_by_path(np->full_name); in attach_node_and_children()
853 update_node_properties(np, dup); in attach_node_and_children()
857 child = np->child; in attach_node_and_children()
858 np->child = NULL; in attach_node_and_children()
862 np->sibling = np->parent->child; in attach_node_and_children()
863 np->parent->child = np; in attach_node_and_children()
864 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
867 __of_attach_node_sysfs(np); in attach_node_and_children()
886 struct device_node *unittest_data_node, *np; in unittest_data_add() local
924 for_each_of_allnodes(np) in unittest_data_add()
925 __of_attach_node_sysfs(np); in unittest_data_add()
932 np = unittest_data_node->child; in unittest_data_add()
933 while (np) { in unittest_data_add()
934 struct device_node *next = np->sibling; in unittest_data_add()
936 np->parent = of_root; in unittest_data_add()
937 attach_node_and_children(np); in unittest_data_add()
938 np = next; in unittest_data_add()
948 struct device_node *np = dev->of_node; in unittest_probe() local
950 if (np == NULL) { in unittest_probe()
956 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_probe()
958 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
966 struct device_node *np = dev->of_node; in unittest_remove() local
968 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_remove()
990 struct device_node *np; in of_path_to_platform_device() local
993 np = of_find_node_by_path(path); in of_path_to_platform_device()
994 if (np == NULL) in of_path_to_platform_device()
997 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
998 of_node_put(np); in of_path_to_platform_device()
1018 struct device_node *np; in of_path_to_i2c_client() local
1021 np = of_find_node_by_path(path); in of_path_to_i2c_client()
1022 if (np == NULL) in of_path_to_i2c_client()
1025 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
1026 of_node_put(np); in of_path_to_i2c_client()
1170 struct device_node *np = NULL; in of_unittest_apply_overlay() local
1173 np = of_find_node_by_path(overlay_path(overlay_nr)); in of_unittest_apply_overlay()
1174 if (np == NULL) { in of_unittest_apply_overlay()
1181 ret = of_overlay_create(np); in of_unittest_apply_overlay()
1193 of_node_put(np); in of_unittest_apply_overlay()
1367 struct device_node *np; in of_unittest_overlay_6() local
1388 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_6()
1389 if (np == NULL) { in of_unittest_overlay_6()
1395 ret = of_overlay_create(np); in of_unittest_overlay_6()
1449 struct device_node *np; in of_unittest_overlay_8() local
1458 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_8()
1459 if (np == NULL) { in of_unittest_overlay_8()
1465 ret = of_overlay_create(np); in of_unittest_overlay_8()
1567 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
1572 if (np == NULL) { in unittest_i2c_bus_probe()
1578 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_probe()
1613 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
1616 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_remove()
1640 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
1642 if (!np) { in unittest_i2c_dev_probe()
1647 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_probe()
1655 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
1657 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_remove()
1695 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
1699 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_mux_probe()
1701 if (!np) { in unittest_i2c_mux_probe()
1707 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
1746 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
1750 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_mux_remove()
1930 struct device_node *np; in of_unittest() local
1940 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
1941 if (!np) { in of_unittest()
1945 of_node_put(np); in of_unittest()