Lines Matching full:np
82 struct device_node *np; in of_unittest_find_node_by_name() local
85 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
86 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
87 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
89 of_node_put(np); in of_unittest_find_node_by_name()
93 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
94 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
96 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
97 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
98 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
100 of_node_put(np); in of_unittest_find_node_by_name()
103 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
104 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
105 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
107 of_node_put(np); in of_unittest_find_node_by_name()
111 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
112 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
114 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
115 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
116 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
118 of_node_put(np); in of_unittest_find_node_by_name()
121 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
122 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
123 of_node_put(np); in of_unittest_find_node_by_name()
125 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
126 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
127 of_node_put(np); in of_unittest_find_node_by_name()
129 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
130 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
131 of_node_put(np); in of_unittest_find_node_by_name()
133 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
134 unittest(np && !strcmp("testoption", options), in of_unittest_find_node_by_name()
136 of_node_put(np); in of_unittest_find_node_by_name()
138 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
139 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
141 of_node_put(np); in of_unittest_find_node_by_name()
143 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
144 unittest(np && !strcmp("test/option", options), in of_unittest_find_node_by_name()
146 of_node_put(np); in of_unittest_find_node_by_name()
148 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
149 unittest(np, "NULL option path test failed\n"); in of_unittest_find_node_by_name()
150 of_node_put(np); in of_unittest_find_node_by_name()
152 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
154 unittest(np && !strcmp("testaliasoption", options), in of_unittest_find_node_by_name()
156 of_node_put(np); in of_unittest_find_node_by_name()
158 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
160 unittest(np && !strcmp("test/alias/option", options), in of_unittest_find_node_by_name()
162 of_node_put(np); in of_unittest_find_node_by_name()
164 np = of_find_node_opts_by_path("testcase-alias/phandle-tests/consumer-a:testaliasoption", in of_unittest_find_node_by_name()
166 name = kasprintf(GFP_KERNEL, "%pOF", np); in of_unittest_find_node_by_name()
167 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name) && in of_unittest_find_node_by_name()
170 of_node_put(np); in of_unittest_find_node_by_name()
173 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
174 unittest(np, "NULL option alias path test failed\n"); in of_unittest_find_node_by_name()
175 of_node_put(np); in of_unittest_find_node_by_name()
178 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
179 unittest(np && !options, "option clearing test failed\n"); in of_unittest_find_node_by_name()
180 of_node_put(np); in of_unittest_find_node_by_name()
183 np = of_find_node_opts_by_path("/", &options); in of_unittest_find_node_by_name()
184 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
185 of_node_put(np); in of_unittest_find_node_by_name()
190 struct device_node *np; in of_unittest_dynamic() local
193 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
194 if (!np) { in of_unittest_dynamic()
210 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
217 unittest(of_add_property(np, prop) != 0, in of_unittest_dynamic()
223 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
231 unittest(of_update_property(np, prop) == 0, in of_unittest_dynamic()
235 unittest(of_remove_property(np, prop) == 0, in of_unittest_dynamic()
245 unittest(of_add_property(np, prop) == 0, in of_unittest_dynamic()
249 static int __init of_unittest_check_node_linkage(struct device_node *np) in of_unittest_check_node_linkage() argument
253 for_each_child_of_node_scoped(np, child) { in of_unittest_check_node_linkage()
254 if (child->parent != np) { in of_unittest_check_node_linkage()
256 child, np); in of_unittest_check_node_linkage()
271 struct device_node *np; in of_unittest_check_tree_linkage() local
277 for_each_of_allnodes(np) in of_unittest_check_tree_linkage()
288 static void __init of_unittest_printf_one(struct device_node *np, const char *fmt, in of_unittest_printf_one() argument
302 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
314 snprintf(buf, size+1, fmt, np); in of_unittest_printf_one()
324 struct device_node *np; in of_unittest_printf() local
328 np = of_find_node_by_path(full_name); in of_unittest_printf()
329 if (!np) { in of_unittest_printf()
330 unittest(np, "testcase data missing\n"); in of_unittest_printf()
334 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
336 of_unittest_printf_one(np, "%pOF", full_name); in of_unittest_printf()
337 of_unittest_printf_one(np, "%pOFf", full_name); in of_unittest_printf()
338 of_unittest_printf_one(np, "%pOFn", "dev"); in of_unittest_printf()
339 of_unittest_printf_one(np, "%2pOFn", "dev"); in of_unittest_printf()
340 of_unittest_printf_one(np, "%5pOFn", " dev"); in of_unittest_printf()
341 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
342 of_unittest_printf_one(np, "%pOFp", phandle_str); in of_unittest_printf()
343 of_unittest_printf_one(np, "%pOFP", "dev@100"); in of_unittest_printf()
344 of_unittest_printf_one(np, "ABC %pOFP ABC", "ABC dev@100 ABC"); in of_unittest_printf()
345 of_unittest_printf_one(np, "%10pOFP", " dev@100"); in of_unittest_printf()
346 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
348 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
349 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
350 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
351 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
352 of_unittest_printf_one(np, "%pOFC", in of_unittest_printf()
358 struct device_node *np; member
364 struct device_node *np; in of_unittest_check_phandles() local
369 for_each_of_allnodes(np) { in of_unittest_check_phandles()
370 if (!np->phandle) in of_unittest_check_phandles()
373 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
374 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
376 np->phandle, nh->np, np); in of_unittest_check_phandles()
386 nh->np = np; in of_unittest_check_phandles()
387 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
402 struct device_node *np; in of_unittest_parse_phandle_with_args() local
406 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
407 if (!np) { in of_unittest_parse_phandle_with_args()
412 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
419 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
468 i, args.np, rc); in of_unittest_parse_phandle_with_args()
471 of_node_put(args.np); in of_unittest_parse_phandle_with_args()
476 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
479 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
489 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
500 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
514 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
525 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
539 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
550 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
561 struct device_node *np, *p[6] = {}; in of_unittest_parse_phandle_with_args_map() local
566 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
567 if (!np) { in of_unittest_parse_phandle_with_args_map()
586 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
593 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
600 passed &= (args.np == p[1]); in of_unittest_parse_phandle_with_args_map()
606 passed &= (args.np == p[3]); in of_unittest_parse_phandle_with_args_map()
617 passed &= (args.np == p[0]); in of_unittest_parse_phandle_with_args_map()
622 passed &= (args.np == p[1]); in of_unittest_parse_phandle_with_args_map()
628 passed &= (args.np == p[0]); in of_unittest_parse_phandle_with_args_map()
633 passed &= (args.np == p[2]); in of_unittest_parse_phandle_with_args_map()
640 passed &= (args.np == p[3]); in of_unittest_parse_phandle_with_args_map()
654 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
657 of_node_put(args.np); in of_unittest_parse_phandle_with_args_map()
662 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
672 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
685 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
698 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
716 struct device_node *np; in of_unittest_property_string() local
719 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
720 if (!np) { in of_unittest_property_string()
725 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
727 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
729 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
731 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
733 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
735 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
737 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
741 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
743 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
745 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
747 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
751 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
754 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
756 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
758 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
760 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
763 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
766 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
768 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
771 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
776 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
778 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
780 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
783 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
787 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
790 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
825 struct device_node *n1, *n2, *n21, *n22, *nchangeset, *nremove, *parent, *np; in of_unittest_changeset() local
900 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
902 of_node_put(np); in of_unittest_changeset()
903 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n22")), in of_unittest_changeset()
905 of_node_put(np); in of_unittest_changeset()
929 static void __init __maybe_unused changeset_check_string(struct device_node *np, in changeset_check_string() argument
936 ret = of_property_read_string(np, prop_name, &str); in changeset_check_string()
945 static void __init __maybe_unused changeset_check_string_array(struct device_node *np, in changeset_check_string_array() argument
955 cnt = of_property_count_strings(np, prop_name); in changeset_check_string_array()
965 ret = of_property_read_string_index(np, prop_name, i, &str); in changeset_check_string_array()
975 static void __init __maybe_unused changeset_check_u32(struct device_node *np, in changeset_check_u32() argument
982 ret = of_property_read_u32(np, prop_name, &val32); in changeset_check_u32()
991 static void __init __maybe_unused changeset_check_u32_array(struct device_node *np, in changeset_check_u32_array() argument
1001 cnt = of_property_count_u32_elems(np, prop_name); in changeset_check_u32_array()
1011 ret = of_property_read_u32_index(np, prop_name, i, &val32); in changeset_check_u32_array()
1021 static void __init __maybe_unused changeset_check_bool(struct device_node *np, in changeset_check_bool() argument
1024 unittest(of_property_read_bool(np, prop_name), in changeset_check_bool()
1033 struct device_node *nchangeset, *np; in of_unittest_changeset_prop() local
1045 np = of_changeset_create_node(&chgset, nchangeset, "test-prop"); in of_unittest_changeset_prop()
1046 if (unittest(np, "failed to create test-prop node\n")) in of_unittest_changeset_prop()
1049 ret = of_changeset_add_prop_string(&chgset, np, "prop-string", "abcde"); in of_unittest_changeset_prop()
1052 ret = of_changeset_add_prop_string_array(&chgset, np, "prop-string-array", in of_unittest_changeset_prop()
1056 ret = of_changeset_add_prop_u32(&chgset, np, "prop-u32", 1234); in of_unittest_changeset_prop()
1059 ret = of_changeset_add_prop_u32_array(&chgset, np, "prop-u32-array", in of_unittest_changeset_prop()
1063 ret = of_changeset_add_prop_bool(&chgset, np, "prop-bool"); in of_unittest_changeset_prop()
1066 of_node_put(np); in of_unittest_changeset_prop()
1072 np = of_find_node_by_path("/testcase-data/changeset/test-prop"); in of_unittest_changeset_prop()
1073 if (unittest(np, "failed to find test-prop node\n")) in of_unittest_changeset_prop()
1076 changeset_check_string(np, "prop-string", "abcde"); in of_unittest_changeset_prop()
1077 changeset_check_string_array(np, "prop-string-array", str_array, ARRAY_SIZE(str_array)); in of_unittest_changeset_prop()
1078 changeset_check_u32(np, "prop-u32", 1234); in of_unittest_changeset_prop()
1079 changeset_check_u32_array(np, "prop-u32-array", u32_array, ARRAY_SIZE(u32_array)); in of_unittest_changeset_prop()
1080 changeset_check_bool(np, "prop-bool"); in of_unittest_changeset_prop()
1082 of_node_put(np); in of_unittest_changeset_prop()
1096 struct device_node *np; in of_unittest_dma_get_max_cpu_address() local
1102 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
1103 if (!np) { in of_unittest_dma_get_max_cpu_address()
1108 cpu_addr = of_dma_get_max_cpu_address(np); in of_unittest_dma_get_max_cpu_address()
1118 struct device_node *np; in of_unittest_dma_ranges_one() local
1122 np = of_find_node_by_path(path); in of_unittest_dma_ranges_one()
1123 if (!np) { in of_unittest_dma_ranges_one()
1128 rc = of_dma_get_range(np, &map); in of_unittest_dma_ranges_one()
1130 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
1150 &paddr, expect_paddr, np); in of_unittest_dma_ranges_one()
1153 &dma_addr, expect_dma_addr, np); in of_unittest_dma_ranges_one()
1158 of_node_put(np); in of_unittest_dma_ranges_one()
1175 struct device_node *np; in of_unittest_pci_dma_ranges() local
1183 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
1184 if (!np) { in of_unittest_pci_dma_ranges()
1189 if (of_pci_dma_range_parser_init(&parser, np)) { in of_unittest_pci_dma_ranges()
1201 np, range.size); in of_unittest_pci_dma_ranges()
1204 range.cpu_addr, np); in of_unittest_pci_dma_ranges()
1207 range.pci_addr, np); in of_unittest_pci_dma_ranges()
1211 np, range.size); in of_unittest_pci_dma_ranges()
1214 range.cpu_addr, np); in of_unittest_pci_dma_ranges()
1217 range.pci_addr, np); in of_unittest_pci_dma_ranges()
1222 of_node_put(np); in of_unittest_pci_dma_ranges()
1227 struct device_node *np; in of_unittest_pci_empty_dma_ranges() local
1234 …np = of_find_node_by_path("/testcase-data/address-tests2/pcie@d1070000/pci@0,0/dev@0,0/local-bus@0… in of_unittest_pci_empty_dma_ranges()
1235 if (!np) { in of_unittest_pci_empty_dma_ranges()
1240 if (of_pci_dma_range_parser_init(&parser, np)) { in of_unittest_pci_empty_dma_ranges()
1251 np, range.size); in of_unittest_pci_empty_dma_ranges()
1254 range.cpu_addr, np); in of_unittest_pci_empty_dma_ranges()
1257 range.pci_addr, np); in of_unittest_pci_empty_dma_ranges()
1260 of_node_put(np); in of_unittest_pci_empty_dma_ranges()
1265 struct device_node *np; in of_unittest_bus_ranges() local
1271 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1272 if (!np) { in of_unittest_bus_ranges()
1277 if (of_range_parser_init(&parser, np)) { in of_unittest_bus_ranges()
1282 ret = of_range_to_resource(np, 1, &res); in of_unittest_bus_ranges()
1284 ret, np); in of_unittest_bus_ranges()
1287 np, &res); in of_unittest_bus_ranges()
1290 np, &res); in of_unittest_bus_ranges()
1293 np, &res); in of_unittest_bus_ranges()
1298 np, count); in of_unittest_bus_ranges()
1306 np, range.flags, IORESOURCE_MEM); in of_unittest_bus_ranges()
1310 np, range.size); in of_unittest_bus_ranges()
1313 range.cpu_addr, np); in of_unittest_bus_ranges()
1316 range.pci_addr, np); in of_unittest_bus_ranges()
1320 np, range.size); in of_unittest_bus_ranges()
1323 range.cpu_addr, np); in of_unittest_bus_ranges()
1326 range.pci_addr, np); in of_unittest_bus_ranges()
1331 of_node_put(np); in of_unittest_bus_ranges()
1336 struct device_node *np; in of_unittest_bus_3cell_ranges() local
1341 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); in of_unittest_bus_3cell_ranges()
1342 if (!np) { in of_unittest_bus_3cell_ranges()
1347 if (of_range_parser_init(&parser, np)) { in of_unittest_bus_3cell_ranges()
1359 np, range.flags); in of_unittest_bus_3cell_ranges()
1362 np, range.size); in of_unittest_bus_3cell_ranges()
1365 range.cpu_addr, np); in of_unittest_bus_3cell_ranges()
1368 range.pci_addr, np); in of_unittest_bus_3cell_ranges()
1372 np, range.flags); in of_unittest_bus_3cell_ranges()
1375 np, range.size); in of_unittest_bus_3cell_ranges()
1378 range.cpu_addr, np); in of_unittest_bus_3cell_ranges()
1381 range.pci_addr, np); in of_unittest_bus_3cell_ranges()
1386 of_node_put(np); in of_unittest_bus_3cell_ranges()
1391 struct device_node *np; in of_unittest_reg() local
1396 np = of_find_node_by_path("/testcase-data/address-tests/bus@80000000/device@1000"); in of_unittest_reg()
1397 if (!np) { in of_unittest_reg()
1402 ret = of_property_read_reg(np, 0, &addr, &size); in of_unittest_reg()
1404 np, ret); in of_unittest_reg()
1406 np, addr); in of_unittest_reg()
1408 of_node_put(np); in of_unittest_reg()
1410 np = of_find_node_by_path("/testcase-data/platform-tests-2/node/test-device@100"); in of_unittest_reg()
1411 if (!np) { in of_unittest_reg()
1416 ret = of_address_to_resource(np, 0, &res); in of_unittest_reg()
1418 np); in of_unittest_reg()
1420 of_node_put(np); in of_unittest_reg()
1434 struct device_node *np; in of_unittest_check_addr() local
1442 np = of_find_node_by_path(node_path); in of_unittest_check_addr()
1443 if (!np) { in of_unittest_check_addr()
1451 ret = of_address_to_resource(np, expected->index, &res); in of_unittest_check_addr()
1453 np, expected->index, ret); in of_unittest_check_addr()
1458 np, expected->index, &res, &expected->res); in of_unittest_check_addr()
1462 of_node_put(np); in of_unittest_check_addr()
1502 struct device_node *np; in of_unittest_parse_interrupts() local
1509 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1510 if (!np) { in of_unittest_parse_interrupts()
1519 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1526 i, args.np, rc); in of_unittest_parse_interrupts()
1528 of_node_put(np); in of_unittest_parse_interrupts()
1530 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1531 if (!np) { in of_unittest_parse_interrupts()
1540 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1572 i, args.np, rc); in of_unittest_parse_interrupts()
1574 of_node_put(np); in of_unittest_parse_interrupts()
1579 struct device_node *np; in of_unittest_parse_interrupts_extended() local
1586 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1587 if (!np) { in of_unittest_parse_interrupts_extended()
1596 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
1652 i, args.np, rc); in of_unittest_parse_interrupts_extended()
1654 of_node_put(np); in of_unittest_parse_interrupts_extended()
1694 struct device_node *np; in of_unittest_match_node() local
1699 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
1700 if (!np) { in of_unittest_match_node()
1706 match = of_match_node(match_node_table, np); in of_unittest_match_node()
1730 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1737 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1738 of_platform_default_populate(np, NULL, NULL); in of_unittest_platform_populate()
1741 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1742 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1751 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1752 pdev = of_find_device_by_node(np); in of_unittest_platform_populate()
1767 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1768 unittest(np, "No testcase data in device tree\n"); in of_unittest_platform_populate()
1769 if (!np) in of_unittest_platform_populate()
1776 of_node_put(np); in of_unittest_platform_populate()
1779 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1790 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1791 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1802 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1810 of_node_put(np); in of_unittest_platform_populate()
1815 * of np into dup node (present in live tree) and
1816 * updates parent of children of np to dup.
1818 * @np: node whose properties are being added to the live tree
1821 static void update_node_properties(struct device_node *np, in update_node_properties() argument
1829 for_each_child_of_node(np, child) in update_node_properties()
1849 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1856 np, prop->name); in update_node_properties()
1864 * CAUTION: misleading function name - if node @np already exists in
1865 * the live tree then children of @np are *not* attached to the live
1869 * @np: Node to attach to live tree
1871 static void attach_node_and_children(struct device_node *np) in attach_node_and_children() argument
1877 full_name = kasprintf(GFP_KERNEL, "%pOF", np); in attach_node_and_children()
1890 update_node_properties(np, dup); in attach_node_and_children()
1894 child = np->child; in attach_node_and_children()
1895 np->child = NULL; in attach_node_and_children()
1899 np->sibling = np->parent->child; in attach_node_and_children()
1900 np->parent->child = np; in attach_node_and_children()
1901 of_node_clear_flag(np, OF_DETACHED); in attach_node_and_children()
1904 __of_attach_node_sysfs(np); in attach_node_and_children()
1922 struct device_node *unittest_data_node = NULL, *np; in unittest_data_add() local
1980 np = unittest_data_node->child; in unittest_data_add()
1981 while (np) { in unittest_data_add()
1982 struct device_node *next = np->sibling; in unittest_data_add()
1984 np->parent = of_root; in unittest_data_add()
1985 /* this will clear OF_DETACHED in np and children */ in unittest_data_add()
1986 attach_node_and_children(np); in unittest_data_add()
1987 np = next; in unittest_data_add()
2004 struct device_node *np = dev->of_node; in unittest_probe() local
2006 if (np == NULL) { in unittest_probe()
2012 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
2014 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
2022 struct device_node *np = dev->of_node; in unittest_remove() local
2024 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
2044 struct device_node *np; in of_path_to_platform_device() local
2047 np = of_find_node_by_path(path); in of_path_to_platform_device()
2048 if (np == NULL) in of_path_to_platform_device()
2051 pdev = of_find_device_by_node(np); in of_path_to_platform_device()
2052 of_node_put(np); in of_path_to_platform_device()
2280 struct device_node *np; in of_path_to_i2c_client() local
2283 np = of_find_node_by_path(path); in of_path_to_i2c_client()
2284 if (np == NULL) in of_path_to_i2c_client()
2287 client = of_find_i2c_device_by_node(np); in of_path_to_i2c_client()
2288 of_node_put(np); in of_path_to_i2c_client()
2897 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe() local
2902 if (np == NULL) { in unittest_i2c_bus_probe()
2908 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
2941 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove() local
2944 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
2965 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe() local
2967 if (!np) { in unittest_i2c_dev_probe()
2972 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
2980 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove() local
2982 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
3011 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
3015 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
3017 if (!np) { in unittest_i2c_mux_probe()
3023 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
3055 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove() local
3058 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
3454 struct device_node *np; in of_unittest_lifecycle() local
3470 np = of_find_node_by_path(refcount_path); in of_unittest_lifecycle()
3471 unittest(np, "find refcount_path \"%s\"\n", refcount_path); in of_unittest_lifecycle()
3472 if (np == NULL) in of_unittest_lifecycle()
3482 refcount = kref_read(&np->kobj.kref); in of_unittest_lifecycle()
3486 of_node_put(np); in of_unittest_lifecycle()
3497 of_node_put(np); in of_unittest_lifecycle()
3517 of_node_put(np); in of_unittest_lifecycle()
3534 of_node_put(np); in of_unittest_lifecycle()
3558 np = of_find_node_by_path(refcount_parent_path); in of_unittest_lifecycle()
3559 unittest(np, "find refcount_parent_path \"%s\"\n", refcount_parent_path); in of_unittest_lifecycle()
3560 unittest(np, "ERROR: devicetree live tree left in a 'bad state' if test fail\n"); in of_unittest_lifecycle()
3561 if (np == NULL) in of_unittest_lifecycle()
3564 prev_sibling = np->child; in of_unittest_lifecycle()
3567 np->child = next_sibling; in of_unittest_lifecycle()
3576 of_node_put(np); in of_unittest_lifecycle()
3835 struct device_node *np; in of_unittest_overlay_high_level() local
3866 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3867 if (of_node_name_eq(np, "__local_fixups__")) { in of_unittest_overlay_high_level()
3868 *pprev = np->sibling; in of_unittest_overlay_high_level()
3871 pprev = &np->sibling; in of_unittest_overlay_high_level()
3879 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3880 if (of_node_name_eq(np, "__symbols__")) { in of_unittest_overlay_high_level()
3881 overlay_base_symbols = np; in of_unittest_overlay_high_level()
3882 *pprev = np->sibling; in of_unittest_overlay_high_level()
3885 pprev = &np->sibling; in of_unittest_overlay_high_level()
3889 for_each_child_of_node(overlay_base_root, np) { in of_unittest_overlay_high_level()
3892 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3894 np); in of_unittest_overlay_high_level()
3895 of_node_put(np); in of_unittest_overlay_high_level()
3910 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3911 np->parent = of_root; in of_unittest_overlay_high_level()
3915 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3916 last_sibling = np; in of_unittest_overlay_high_level()
3923 for_each_of_allnodes_from(overlay_base_root, np) in of_unittest_overlay_high_level()
3924 __of_attach_node_sysfs(np); in of_unittest_overlay_high_level()
4203 struct device_node *pnp, *np = NULL; in of_unittest_pci_node_verify() local
4216 np = of_find_node_by_path(path); in of_unittest_pci_node_verify()
4217 unittest(np, "Failed to get unittest-pci node under PCI node\n"); in of_unittest_pci_node_verify()
4218 if (!np) { in of_unittest_pci_node_verify()
4223 reg = of_get_property(np, "reg", NULL); in of_unittest_pci_node_verify()
4229 np = of_find_node_by_path(path); in of_unittest_pci_node_verify()
4230 unittest(!np, "Child device tree node is not removed\n"); in of_unittest_pci_node_verify()
4237 if (np) in of_unittest_pci_node_verify()
4238 of_node_put(np); in of_unittest_pci_node_verify()
4292 struct device_node *np; in of_unittest() local
4307 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
4308 if (!np) { in of_unittest()
4312 of_node_put(np); in of_unittest()