Lines Matching refs:np

45 	struct device_node *np;
47 np = of_find_node_by_path("/testcase-data");
48 selftest(np && !strcmp("/testcase-data", np->full_name),
50 of_node_put(np);
53 np = of_find_node_by_path("/testcase-data/");
54 selftest(!np, "trailing '/' on /testcase-data/ should fail\n");
56 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
57 selftest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name),
59 of_node_put(np);
61 np = of_find_node_by_path("testcase-alias");
62 selftest(np && !strcmp("/testcase-data", np->full_name),
64 of_node_put(np);
67 np = of_find_node_by_path("testcase-alias/");
68 selftest(!np, "trailing '/' on testcase-alias/ should fail\n");
70 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
71 selftest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name),
73 of_node_put(np);
75 np = of_find_node_by_path("/testcase-data/missing-path");
76 selftest(!np, "non-existent path returned node %s\n", np->full_name);
77 of_node_put(np);
79 np = of_find_node_by_path("missing-alias");
80 selftest(!np, "non-existent alias returned node %s\n", np->full_name);
81 of_node_put(np);
83 np = of_find_node_by_path("testcase-alias/missing-path");
84 selftest(!np, "non-existent alias with relative path returned node %s\n", np->full_name);
85 of_node_put(np);
90 struct device_node *np;
93 np = of_find_node_by_path("/testcase-data");
94 if (!np) {
110 selftest(of_add_property(np, prop) == 0, "Adding a new property failed\n");
117 selftest(of_add_property(np, prop) != 0,
123 selftest(of_update_property(np, prop) == 0,
131 selftest(of_update_property(np, prop) == 0,
135 selftest(of_remove_property(np, prop) == 0,
145 selftest(of_add_property(np, prop) == 0,
149 static int __init of_selftest_check_node_linkage(struct device_node *np)
151 struct device_node *child, *allnext_index = np;
154 for_each_child_of_node(np, child) {
155 if (child->parent != np) {
157 child->name, np->name);
180 struct device_node *np;
186 for_each_of_allnodes(np)
198 struct device_node *np;
204 struct device_node *np;
209 for_each_of_allnodes(np) {
210 if (!np->phandle)
213 hash_for_each_possible(phandle_ht, nh, node, np->phandle) {
214 if (nh->np->phandle == np->phandle) {
216 np->phandle, nh->np->full_name, np->full_name);
226 nh->np = np;
227 hash_add(phandle_ht, &nh->node, np->phandle);
242 struct device_node *np;
246 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
247 if (!np) {
252 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells");
257 rc = of_parse_phandle_with_args(np, "phandle-list",
306 i, args.np->full_name, rc);
310 rc = of_parse_phandle_with_args(np, "phandle-list-missing",
313 rc = of_count_phandle_with_args(np, "phandle-list-missing",
318 rc = of_parse_phandle_with_args(np, "phandle-list",
321 rc = of_count_phandle_with_args(np, "phandle-list",
326 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle",
329 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle",
334 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args",
337 rc = of_count_phandle_with_args(np, "phandle-list-bad-args",
345 struct device_node *np;
348 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
349 if (!np) {
354 rc = of_property_match_string(np, "phandle-list-names", "first");
356 rc = of_property_match_string(np, "phandle-list-names", "second");
358 rc = of_property_match_string(np, "phandle-list-names", "third");
360 rc = of_property_match_string(np, "phandle-list-names", "fourth");
362 rc = of_property_match_string(np, "missing-property", "blah");
364 rc = of_property_match_string(np, "empty-property", "blah");
366 rc = of_property_match_string(np, "unterminated-string", "blah");
370 rc = of_property_count_strings(np, "string-property");
372 rc = of_property_count_strings(np, "phandle-list-names");
374 rc = of_property_count_strings(np, "unterminated-string");
376 rc = of_property_count_strings(np, "unterminated-string-list");
380 rc = of_property_read_string_index(np, "string-property", 0, strings);
383 rc = of_property_read_string_index(np, "string-property", 1, strings);
385 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings);
387 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings);
389 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings);
392 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings);
395 rc = of_property_read_string_index(np, "unterminated-string", 0, strings);
397 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings);
400 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */
405 rc = of_property_read_string_array(np, "string-property", strings, 4);
407 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4);
409 rc = of_property_read_string_array(np, "unterminated-string", strings, 4);
412 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4);
416 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2);
419 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1);
500 struct device_node *np;
504 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0");
505 if (!np) {
513 rc = of_irq_parse_one(np, i, &args);
520 i, args.np->full_name, rc);
522 of_node_put(np);
524 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1");
525 if (!np) {
533 rc = of_irq_parse_one(np, i, &args);
565 i, args.np->full_name, rc);
567 of_node_put(np);
572 struct device_node *np;
576 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0");
577 if (!np) {
584 rc = of_irq_parse_one(np, i, &args);
634 i, args.np->full_name, rc);
636 of_node_put(np);
676 struct device_node *np;
681 np = of_find_node_by_path(match_node_tests[i].path);
682 if (!np) {
688 match = of_match_node(match_node_table, np);
708 struct device_node *np, *child;
715 np = of_find_node_by_path("/testcase-data");
716 of_platform_populate(np, of_default_bus_match_table, NULL, NULL);
719 np = of_find_node_by_path("/testcase-data/testcase-device1");
720 pdev = of_find_device_by_node(np);
727 np = of_find_node_by_path("/testcase-data/testcase-device2");
728 pdev = of_find_device_by_node(np);
733 np = of_find_node_by_path("/testcase-data/platform-tests");
734 if (!np) {
739 for_each_child_of_node(np, child) {
751 * of np into dup node (present in live tree) and
752 * updates parent of children of np to dup.
754 * @np: node already present in live tree
757 static void update_node_properties(struct device_node *np,
763 for_each_property_of_node(np, prop)
766 for_each_child_of_node(np, child)
774 * @np: Node to attach to live tree
776 static int attach_node_and_children(struct device_node *np)
778 struct device_node *next, *root = np, *dup;
781 np = np->child;
783 dup = np;
793 while (np) {
794 next = np->allnext;
795 dup = of_find_node_by_path(np->full_name);
797 update_node_properties(np, dup);
799 np->child = NULL;
800 if (np->parent == root)
801 np->parent = of_allnodes;
802 of_attach_node(np);
804 np = next;
817 struct device_node *selftest_data_node, *np;
854 for_each_of_allnodes(np)
855 __of_attach_node_sysfs(np);
869 * @np: Node to detach from live tree
871 static void detach_node_and_children(struct device_node *np)
873 while (np->child)
874 detach_node_and_children(np->child);
875 of_detach_node(np);
884 struct device_node *np;
892 for_each_child_of_node(of_allnodes, np)
893 detach_node_and_children(np);
901 np = of_find_node_by_path(nodes[last_node_index]->full_name);
902 if (np == nodes[last_node_index]) {
903 if (of_aliases == np) {
907 detach_node_and_children(np);
909 for_each_property_of_node(np, prop) {
911 of_remove_property(np, prop);
920 struct device_node *np;
930 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
931 if (!np) {
935 of_node_put(np);