Lines Matching refs:np
48 struct device_node *np; in of_unittest_find_node_by_name() local
51 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
52 unittest(np && !strcmp("/testcase-data", np->full_name), in of_unittest_find_node_by_name()
54 of_node_put(np); in of_unittest_find_node_by_name()
57 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
58 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
60 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
61 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), in of_unittest_find_node_by_name()
63 of_node_put(np); in of_unittest_find_node_by_name()
65 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
66 unittest(np && !strcmp("/testcase-data", np->full_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 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
74 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
75 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name), in of_unittest_find_node_by_name()
77 of_node_put(np); in of_unittest_find_node_by_name()
79 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
80 unittest(!np, "non-existent path returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
81 of_node_put(np); in of_unittest_find_node_by_name()
83 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
84 unittest(!np, "non-existent alias returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
85 of_node_put(np); in of_unittest_find_node_by_name()
87 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
88 unittest(!np, "non-existent alias with relative path returned node %s\n", np->full_name); in of_unittest_find_node_by_name()
89 of_node_put(np); in of_unittest_find_node_by_name()
91 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
92 unittest(np && !strcmp("testoption", options), in of_unittest_find_node_by_name()
94 of_node_put(np); in of_unittest_find_node_by_name()
96 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
97 unittest(np && !strcmp("test/option", options), 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/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
102 unittest(np && !strcmp("test/option", 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:testoption", NULL); in of_unittest_find_node_by_name()
107 unittest(np, "NULL option path test failed\n"); in of_unittest_find_node_by_name()
108 of_node_put(np); in of_unittest_find_node_by_name()
110 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
112 unittest(np && !strcmp("testaliasoption", 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-alias:test/alias/option", in of_unittest_find_node_by_name()
118 unittest(np && !strcmp("test/alias/option", options), in of_unittest_find_node_by_name()
120 of_node_put(np); in of_unittest_find_node_by_name()
122 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
123 unittest(np, "NULL option alias path test failed\n"); in of_unittest_find_node_by_name()
124 of_node_put(np); in of_unittest_find_node_by_name()
127 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
128 unittest(np && !options, "option clearing test failed\n"); in of_unittest_find_node_by_name()
129 of_node_put(np); in of_unittest_find_node_by_name()
132 np = of_find_node_opts_by_path("/", &options); in of_unittest_find_node_by_name()
133 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
134 of_node_put(np); in of_unittest_find_node_by_name()
139 struct device_node *np; in of_unittest_dynamic() local
142 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
143 if (!np) { in of_unittest_dynamic()
159 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
166 unittest(of_add_property(np, prop) != 0, in of_unittest_dynamic()
172 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
180 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
184 unittest(of_remove_property(np, prop) == 0, in of_unittest_dynamic()
194 unittest(of_add_property(np, prop) == 0, in of_unittest_dynamic()
198 static int __init of_unittest_check_node_linkage(struct device_node *np) in of_unittest_check_node_linkage() argument
203 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
204 if (child->parent != np) { in of_unittest_check_node_linkage()
206 child->name, np->name); in of_unittest_check_node_linkage()
225 struct device_node *np; in of_unittest_check_tree_linkage() local
231 for_each_of_allnodes(np) in of_unittest_check_tree_linkage()
244 struct device_node *np; member
250 struct device_node *np; in of_unittest_check_phandles() local
255 for_each_of_allnodes(np) { in of_unittest_check_phandles()
256 if (!np->phandle) in of_unittest_check_phandles()
259 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
260 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
262 np->phandle, nh->np->full_name, np->full_name); in of_unittest_check_phandles()
272 nh->np = np; in of_unittest_check_phandles()
273 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
288 struct device_node *np; in of_unittest_parse_phandle_with_args() local
292 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
293 if (!np) { in of_unittest_parse_phandle_with_args()
298 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
304 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
353 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args()
357 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
360 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
365 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
368 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
373 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
376 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
381 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
384 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
392 struct device_node *np; in of_unittest_property_string() local
395 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
396 if (!np) { in of_unittest_property_string()
401 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
403 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
405 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
407 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
409 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
411 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
413 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
417 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
419 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
421 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
423 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
427 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
430 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
432 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
434 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
436 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
439 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
442 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
444 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
447 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
452 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
454 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
456 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
459 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
463 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
466 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
501 struct device_node *n1, *n2, *n21, *nremove, *parent, *np; in of_unittest_changeset() local
535 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
537 of_node_put(np); in of_unittest_changeset()
547 struct device_node *np; in of_unittest_parse_interrupts() local
551 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
552 if (!np) { in of_unittest_parse_interrupts()
561 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
568 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
570 of_node_put(np); in of_unittest_parse_interrupts()
572 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
573 if (!np) { in of_unittest_parse_interrupts()
582 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
614 i, args.np->full_name, rc); in of_unittest_parse_interrupts()
616 of_node_put(np); in of_unittest_parse_interrupts()
621 struct device_node *np; in of_unittest_parse_interrupts_extended() local
625 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
626 if (!np) { in of_unittest_parse_interrupts_extended()
634 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
684 i, args.np->full_name, rc); in of_unittest_parse_interrupts_extended()
686 of_node_put(np); in of_unittest_parse_interrupts_extended()
726 struct device_node *np; in of_unittest_match_node() local
731 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
732 if (!np) { in of_unittest_match_node()
738 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_default_populate(np, 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()
812 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
813 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
821 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
829 of_node_put(np); in of_unittest_platform_populate()
840 static void update_node_properties(struct device_node *np, in update_node_properties() argument
846 for_each_property_of_node(np, prop) in update_node_properties()
849 for_each_child_of_node(np, child) in update_node_properties()
859 static int attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
864 dup = of_find_node_by_path(np->full_name); in attach_node_and_children()
866 update_node_properties(np, dup); in attach_node_and_children()
870 child = np->child; in attach_node_and_children()
871 np->child = NULL; in attach_node_and_children()
875 np->sibling = np->parent->child; in attach_node_and_children()
876 np->parent->child = np; in attach_node_and_children()
877 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
880 __of_attach_node_sysfs(np); in attach_node_and_children()
899 struct device_node *unittest_data_node, *np; in unittest_data_add() local
937 for_each_of_allnodes(np) in unittest_data_add()
938 __of_attach_node_sysfs(np); in unittest_data_add()
945 np = unittest_data_node->child; in unittest_data_add()
946 while (np) { in unittest_data_add()
947 struct device_node *next = np->sibling; in unittest_data_add()
949 np->parent = of_root; in unittest_data_add()
950 attach_node_and_children(np); in unittest_data_add()
951 np = next; in unittest_data_add()
961 struct device_node *np = dev->of_node; in unittest_probe() local
963 if (np == NULL) { in unittest_probe()
969 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_probe()
971 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
979 struct device_node *np = dev->of_node; in unittest_remove() local
981 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_remove()
1002 struct device_node *np; in of_path_to_platform_device() local
1005 np = of_find_node_by_path(path); in of_path_to_platform_device()
1006 if (np == NULL) in of_path_to_platform_device()
1009 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
1010 of_node_put(np); in of_path_to_platform_device()
1030 struct device_node *np; in of_path_to_i2c_client() local
1033 np = of_find_node_by_path(path); in of_path_to_i2c_client()
1034 if (np == NULL) in of_path_to_i2c_client()
1037 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
1038 of_node_put(np); in of_path_to_i2c_client()
1187 struct device_node *np = NULL; in of_unittest_apply_overlay() local
1190 np = of_find_node_by_path(overlay_path(overlay_nr)); in of_unittest_apply_overlay()
1191 if (np == NULL) { in of_unittest_apply_overlay()
1198 ret = of_overlay_create(np); in of_unittest_apply_overlay()
1210 of_node_put(np); in of_unittest_apply_overlay()
1384 struct device_node *np; in of_unittest_overlay_6() local
1405 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_6()
1406 if (np == NULL) { in of_unittest_overlay_6()
1412 ret = of_overlay_create(np); in of_unittest_overlay_6()
1466 struct device_node *np; in of_unittest_overlay_8() local
1475 np = of_find_node_by_path(overlay_path(overlay_nr + i)); in of_unittest_overlay_8()
1476 if (np == NULL) { in of_unittest_overlay_8()
1482 ret = of_overlay_create(np); in of_unittest_overlay_8()
1584 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
1589 if (np == NULL) { in unittest_i2c_bus_probe()
1595 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_probe()
1630 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
1633 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_bus_remove()
1657 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
1659 if (!np) { in unittest_i2c_dev_probe()
1664 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_probe()
1672 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
1674 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_dev_remove()
1705 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
1709 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); in unittest_i2c_mux_probe()
1711 if (!np) { in unittest_i2c_mux_probe()
1717 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
1751 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
1754 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()