Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property

1 // SPDX-License-Identifier: GPL-2.0
6 #define pr_fmt(fmt) "### dt-test ### " fmt
10 #include <linux/dma-direct.h> /* to test phys_to_dma/dma_to_phys */
28 #include <linux/i2c-mux.h>
53 * Expected message may have a message level other than KERN_INFO.
71 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
73 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
74 "find /testcase-data failed\n"); in of_unittest_find_node_by_name()
79 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
80 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
82 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
84 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
85 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
89 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
91 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
92 "find testcase-alias failed\n"); in of_unittest_find_node_by_name()
97 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
98 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
100 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
102 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
103 "find testcase-alias/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
107 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
108 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
111 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
112 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
115 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
116 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
119 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
124 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
129 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
134 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
138 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
144 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
150 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
155 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
161 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
168 struct property *prop; in of_unittest_dynamic()
170 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
183 /* Add a new property - should pass*/ in of_unittest_dynamic()
184 prop->name = "new-property"; in of_unittest_dynamic()
185 prop->value = "new-property-data"; in of_unittest_dynamic()
186 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
187 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
189 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
191 prop->name = "new-property"; in of_unittest_dynamic()
192 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
193 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
195 "Adding an existing property should have failed\n"); in of_unittest_dynamic()
197 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
198 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
199 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
201 "Updating an existing property should have passed\n"); in of_unittest_dynamic()
203 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
205 prop->name = "modify-property"; in of_unittest_dynamic()
206 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
207 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
209 "Updating a missing property should have passed\n"); in of_unittest_dynamic()
211 /* Remove property - should pass */ in of_unittest_dynamic()
213 "Removing a property should have passed\n"); in of_unittest_dynamic()
215 /* Adding very large property - should pass */ in of_unittest_dynamic()
217 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
218 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
219 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
220 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
221 if (prop->value) in of_unittest_dynamic()
223 "Adding a large property should have passed\n"); in of_unittest_dynamic()
228 struct device_node *child; in of_unittest_check_node_linkage() local
231 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
232 if (child->parent != np) { in of_unittest_check_node_linkage()
233 pr_err("Child node %pOFn links to wrong parent %pOFn\n", in of_unittest_check_node_linkage()
234 child, np); in of_unittest_check_node_linkage()
235 rc = -EINVAL; in of_unittest_check_node_linkage()
239 rc = of_unittest_check_node_linkage(child); in of_unittest_check_node_linkage()
247 of_node_put(child); in of_unittest_check_node_linkage()
263 unittest(child_count > 0, "Device node data structure is corrupted\n"); in of_unittest_check_tree_linkage()
282 /* Baseline; check conversion with a large size limit */ in of_unittest_printf_one()
284 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
293 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
307 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
316 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
323 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
328 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
330 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
331 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
332 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
333 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
335 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
339 struct hlist_node node; member
352 if (!np->phandle) in of_unittest_check_phandles()
355 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
356 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
358 np->phandle, nh->np, np); in of_unittest_check_phandles()
368 nh->np = np; in of_unittest_check_phandles()
369 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
376 hash_for_each_safe(phandle_ht, i, tmp, nh, node) { in of_unittest_check_phandles()
377 hash_del(&nh->node); in of_unittest_check_phandles()
388 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
394 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
401 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
402 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
404 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
418 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
443 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
449 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
453 /* Check for missing list property */ in of_unittest_parse_phandle_with_args()
455 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
456 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
457 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
458 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
459 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
460 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
462 /* Check for missing cells property */ in of_unittest_parse_phandle_with_args()
466 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
468 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
469 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
472 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
474 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
477 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
479 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
480 "#phandle-cells-missing"); in of_unittest_parse_phandle_with_args()
483 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
485 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
491 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
493 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
494 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
497 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
499 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
502 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
504 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
505 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
508 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
510 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
516 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
518 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
519 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
522 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
524 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
527 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
529 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
530 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
533 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
535 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
544 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
550 p0 = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
556 p1 = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
562 p2 = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
568 p3 = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); in of_unittest_parse_phandle_with_args_map()
574 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
581 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
584 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
601 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
627 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
633 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
634 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
637 /* Check for missing list property */ in of_unittest_parse_phandle_with_args_map()
639 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
641 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
643 /* Check for missing cells,map,mask property */ in of_unittest_parse_phandle_with_args_map()
647 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
649 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
650 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
652 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
654 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
660 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle"); in of_unittest_parse_phandle_with_args_map()
662 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
665 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle"); in of_unittest_parse_phandle_with_args_map()
667 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
673 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); in of_unittest_parse_phandle_with_args_map()
675 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
678 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); in of_unittest_parse_phandle_with_args_map()
680 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
689 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
695 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
697 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
699 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
701 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
702 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
703 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
704 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
705 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
706 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
707 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
708 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
711 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
713 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
715 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
716 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
717 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
718 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
721 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
724 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
725 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
726 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
728 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
730 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
733 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
734 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
736 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
737 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
738 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
741 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
742 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
746 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
748 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
750 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
751 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
752 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
753 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
754 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
755 /* -- parsing the correctly formed strings should still work: */ in of_unittest_property_string()
757 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
760 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
764 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
765 (p1)->value && (p2)->value && \
766 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
767 !strcmp((p1)->name, (p2)->name))
771 struct property p1 = { .name = "p1", .length = 0, .value = "" }; in of_unittest_property_copy()
772 struct property p2 = { .name = "p2", .length = 5, .value = "abcd" }; in of_unittest_property_copy()
773 struct property *new; in of_unittest_property_copy()
776 unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n"); in of_unittest_property_copy()
777 kfree(new->value); in of_unittest_property_copy()
778 kfree(new->name); in of_unittest_property_copy()
782 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
783 kfree(new->value); in of_unittest_property_copy()
784 kfree(new->name); in of_unittest_property_copy()
792 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
793 struct property *ppname_n1, pname_n1 = { .name = "name", .length = 3, .value = "n1" }; in of_unittest_changeset()
794 struct property *ppname_n2, pname_n2 = { .name = "name", .length = 3, .value = "n2" }; in of_unittest_changeset()
795 struct property *ppname_n21, pname_n21 = { .name = "name", .length = 3, .value = "n21" }; in of_unittest_changeset()
796 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
797 struct property *ppremove; in of_unittest_changeset()
810 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
811 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
830 n1->parent = parent; in of_unittest_changeset()
831 n2->parent = parent; in of_unittest_changeset()
832 n21->parent = n2; in of_unittest_changeset()
834 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
845 unittest(!of_changeset_detach_node(&chgset, nremove), "fail remove node\n"); in of_unittest_changeset()
850 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
858 /* Make sure node names are constructed correctly */ in of_unittest_changeset()
859 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
881 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
909 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
921 "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
924 "of_dma_get_range: wrong DMA addr %pad (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
935 of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", in of_unittest_parse_dma_ranges()
937 of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", in of_unittest_parse_dma_ranges()
939 of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", in of_unittest_parse_dma_ranges()
953 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
960 pr_err("missing dma-ranges property\n"); in of_unittest_pci_dma_ranges()
965 * Get the dma-ranges from the device tree in of_unittest_pci_dma_ranges()
970 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
973 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
976 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
980 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
983 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
986 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1004 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1020 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1025 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1037 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1066 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1081 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1093 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1140 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
1147 { .data = "A", .name = "name0", }, /* Name alone is lowest priority */
1167 { .path = "/testcase-data/match-node/name0", .data = "A", },
1168 { .path = "/testcase-data/match-node/name1", .data = "B", },
1169 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1170 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1171 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1172 { .path = "/testcase-data/match-node/name3", .data = "E", },
1173 { .path = "/testcase-data/match-node/name4", .data = "G", },
1174 { .path = "/testcase-data/match-node/name5", .data = "H", },
1175 { .path = "/testcase-data/match-node/name6", .data = "G", },
1176 { .path = "/testcase-data/match-node/name7", .data = "I", },
1177 { .path = "/testcase-data/match-node/name8", .data = "J", },
1178 { .path = "/testcase-data/match-node/name9", .data = "K", },
1190 unittest(0, "missing testcase node %s\n", in of_unittest_match_node()
1202 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1205 (const char *)match->data); in of_unittest_match_node()
1214 .name = "unittest-bus",
1219 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1222 { .compatible = "test-device", }, in of_unittest_platform_populate()
1226 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1229 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1230 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1236 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1237 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1239 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1240 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1245 "platform testcase-data:testcase-device2: IRQ index 0 not found"); in of_unittest_platform_populate()
1250 "platform testcase-data:testcase-device2: IRQ index 0 not found"); in of_unittest_platform_populate()
1252 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1253 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1256 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1268 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1271 * Add a dummy resource to the test bus node after it is in of_unittest_platform_populate()
1272 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1279 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1280 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1281 for_each_child_of_node(child, grandchild) { in of_unittest_platform_populate()
1284 "Could not create device for node '%pOFn'\n", in of_unittest_platform_populate()
1290 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1291 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1292 for_each_child_of_node(child, grandchild) in of_unittest_platform_populate()
1303 * update_node_properties - adds the properties
1304 * of np into dup node (present in live tree) and
1307 * @np: node whose properties are being added to the live tree
1308 * @dup: node present in live tree to be updated
1313 struct property *prop; in update_node_properties()
1314 struct property *save_next; in update_node_properties()
1315 struct device_node *child; in update_node_properties() local
1318 for_each_child_of_node(np, child) in update_node_properties()
1319 child->parent = dup; in update_node_properties()
1322 * "unittest internal error: unable to add testdata property" in update_node_properties()
1324 * If this message reports a property in node '/__symbols__' then in update_node_properties()
1325 * the respective unittest overlay contains a label that has the in update_node_properties()
1326 * same name as a label in the live devicetree. The label will in update_node_properties()
1328 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1331 * used in a real devicetree. in update_node_properties()
1336 * sets prop->next to NULL in update_node_properties()
1338 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1339 save_next = prop->next; in update_node_properties()
1342 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1344 pr_err("unittest internal error: unable to add testdata property %pOF/%s", in update_node_properties()
1345 np, prop->name); in update_node_properties()
1351 * attach_node_and_children - attaches nodes
1353 * CAUTION: misleading function name - if node @np already exists in
1356 * nodes do not have child nodes.
1358 * @np: Node to attach to live tree
1362 struct device_node *next, *dup, *child; in attach_node_and_children() local
1381 child = np->child; in attach_node_and_children()
1382 np->child = NULL; in attach_node_and_children()
1386 np->sibling = np->parent->child; in attach_node_and_children()
1387 np->parent->child = np; in attach_node_and_children()
1394 while (child) { in attach_node_and_children()
1395 next = child->sibling; in attach_node_and_children()
1396 attach_node_and_children(child); in attach_node_and_children()
1397 child = next; in attach_node_and_children()
1402 * unittest_data_add - Reads, copies data from
1416 const int size = __dtb_testcases_end - __dtb_testcases_begin; in unittest_data_add()
1422 return -ENODATA; in unittest_data_add()
1428 return -ENOMEM; in unittest_data_add()
1437 return -ENODATA; in unittest_data_add()
1442 return -ENODATA; in unittest_data_add()
1454 return -EINVAL; in unittest_data_add()
1468 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1470 /* attach the sub-tree to live tree */ in unittest_data_add()
1471 np = unittest_data_node->child; in unittest_data_add()
1473 struct device_node *next = np->sibling; in unittest_data_add()
1475 np->parent = of_root; in unittest_data_add()
1481 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1493 struct device *dev = &pdev->dev; in unittest_probe()
1494 struct device_node *np = dev->of_node; in unittest_probe()
1498 return -EINVAL; in unittest_probe()
1502 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
1504 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1511 struct device *dev = &pdev->dev; in unittest_remove()
1512 struct device_node *np = dev->of_node; in unittest_remove()
1514 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
1548 /* find out if a platform device exists at that path */
1572 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
1586 return -ENOMEM; in unittest_gpio_probe()
1590 devptr->chip.of_node = pdev->dev.of_node; in unittest_gpio_probe()
1591 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
1592 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
1593 devptr->chip.ngpio = 5; in unittest_gpio_probe()
1594 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
1596 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
1599 "gpiochip_add_data() for node @%pOF failed, ret = %d\n", devptr->chip.of_node, ret); in unittest_gpio_probe()
1609 struct device *dev = &pdev->dev; in unittest_gpio_remove()
1610 struct device_node *np = pdev->dev.of_node; in unittest_gpio_remove()
1612 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_gpio_remove()
1615 return -EINVAL; in unittest_gpio_remove()
1617 if (gdev->chip.base != -1) in unittest_gpio_remove()
1618 gpiochip_remove(&gdev->chip); in unittest_gpio_remove()
1627 { .compatible = "unittest-gpio", },
1635 .name = "unittest-gpio",
1648 * Similar to installing a driver as a module, the in of_unittest_overlay_gpio()
1656 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
1657 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
1658 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
1659 * - register driver in of_unittest_overlay_gpio()
1662 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
1663 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
1664 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
1671 * overlay_gpio_01 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1672 * overlay_gpio_02a contains gpio node in of_unittest_overlay_gpio()
1673 * overlay_gpio_02b contains child gpio hog node in of_unittest_overlay_gpio()
1691 "GPIO line <<int>> (line-B-input) hogged as input\n"); in of_unittest_overlay_gpio()
1694 "GPIO line <<int>> (line-A-input) hogged as input\n"); in of_unittest_overlay_gpio()
1701 "GPIO line <<int>> (line-A-input) hogged as input\n"); in of_unittest_overlay_gpio()
1703 "GPIO line <<int>> (line-B-input) hogged as input\n"); in of_unittest_overlay_gpio()
1710 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1715 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
1718 * overlay_gpio_03 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1720 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
1723 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
1730 "GPIO line <<int>> (line-D-input) hogged as input\n"); in of_unittest_overlay_gpio()
1732 /* overlay_gpio_03 contains gpio node and child gpio hog node */ in of_unittest_overlay_gpio()
1738 "GPIO line <<int>> (line-D-input) hogged as input\n"); in of_unittest_overlay_gpio()
1745 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1748 * overlay_gpio_04a contains gpio node in of_unittest_overlay_gpio()
1750 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
1753 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
1759 /* overlay_gpio_04a contains gpio node */ in of_unittest_overlay_gpio()
1768 * overlay_gpio_04b contains child gpio hog node in of_unittest_overlay_gpio()
1770 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
1773 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
1777 "GPIO line <<int>> (line-C-input) hogged as input\n"); in of_unittest_overlay_gpio()
1779 /* overlay_gpio_04b contains child gpio hog node */ in of_unittest_overlay_gpio()
1785 "GPIO line <<int>> (line-C-input) hogged as input\n"); in of_unittest_overlay_gpio()
1789 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1819 /* find out if a i2c client device exists at that path */
1826 put_device(&client->dev); in of_path_i2c_client_exists()
1860 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
1863 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
1869 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
1870 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
1893 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
1895 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
1900 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
1906 static int overlay_first_id = -1;
1919 id -= overlay_first_id; in of_unittest_track_overlay()
1930 id -= overlay_first_id; in of_unittest_untrack_overlay()
1947 for (id = MAX_UNITTEST_OVERLAYS - 1; id >= 0; id--) { in of_unittest_destroy_tracked_overlays()
1953 if (ret == -ENODEV) { in of_unittest_destroy_tracked_overlays()
1979 return -EFAULT; in of_unittest_apply_overlay()
1999 return -EINVAL; in of_unittest_apply_overlay_check()
2015 return -EINVAL; in of_unittest_apply_overlay_check()
2034 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2051 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2070 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2082 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2088 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2102 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2108 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2123 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2129 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2142 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2148 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2156 /* test activation of a full device node */
2172 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2178 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2212 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2226 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2229 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2243 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2259 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2299 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2308 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2319 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2325 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2339 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2350 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2361 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2376 /* test insertion of a bus with parent devices */
2389 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2397 unittest(ret, "overlay test %d failed; no child device\n", 10); in of_unittest_overlay_10()
2400 /* test insertion of a bus with parent devices (and revert) */
2441 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2442 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2449 return -EINVAL; in unittest_i2c_bus_probe()
2453 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
2457 return -ENOMEM; in unittest_i2c_bus_probe()
2460 std->pdev = pdev; in unittest_i2c_bus_probe()
2463 adap = &std->adap; in unittest_i2c_bus_probe()
2465 adap->nr = -1; in unittest_i2c_bus_probe()
2466 strlcpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2467 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2468 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2469 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2470 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2471 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2472 adap->retries = 3; in unittest_i2c_bus_probe()
2485 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
2486 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
2489 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
2490 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
2496 { .compatible = "unittest-i2c-bus", },
2504 .name = "unittest-i2c-bus",
2512 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
2513 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
2516 dev_err(dev, "No OF node\n"); in unittest_i2c_dev_probe()
2517 return -EINVAL; in unittest_i2c_dev_probe()
2520 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
2527 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
2528 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
2530 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
2535 { .name = "unittest-i2c-dev" },
2541 .name = "unittest-i2c-dev",
2559 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
2560 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
2561 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
2565 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
2568 dev_err(dev, "No OF node\n"); in unittest_i2c_mux_probe()
2569 return -EINVAL; in unittest_i2c_mux_probe()
2572 max_reg = (u32)-1; in unittest_i2c_mux_probe()
2573 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
2574 if (of_property_read_u32(child, "reg", &reg)) in unittest_i2c_mux_probe()
2576 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
2579 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
2582 return -EINVAL; in unittest_i2c_mux_probe()
2588 return -ENOMEM; in unittest_i2c_mux_probe()
2593 return -ENODEV; in unittest_i2c_mux_probe()
2604 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
2605 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
2608 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
2614 { .name = "unittest-i2c-mux" },
2620 .name = "unittest-i2c-mux",
2647 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2652 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2677 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2682 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2696 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2702 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2721 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2726 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2868 OVERLAY_INFO(overlay_base, -9999),
2891 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL),
2892 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL),
2893 OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
2894 OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
2935 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
2936 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
2948 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
2953 data_size = info->dtb_end - info->dtb_begin; in unittest_unflatten_overlay_base()
2959 size = fdt_totalsize(info->dtb_begin); in unittest_unflatten_overlay_base()
2971 memcpy(new_fdt, info->dtb_begin, size); in unittest_unflatten_overlay_base()
2979 * overlay in the normal fashion. This is a test of the whole
2982 * A secondary purpose is to be able to verify that the contents of
2983 * /proc/device-tree/ contains the updated structure and values from
2995 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
2996 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3006 size = info->dtb_end - info->dtb_begin; in overlay_data_apply()
3010 ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->overlay_id); in overlay_data_apply()
3012 *overlay_id = info->overlay_id; in overlay_data_apply()
3019 if (ret != info->expected_result) in overlay_data_apply()
3021 info->expected_result, ret, overlay_name); in overlay_data_apply()
3023 return (ret == info->expected_result); in overlay_data_apply()
3028 * in the normal fashion. This is a test of the whole picture,
3041 struct property *prop; in of_unittest_overlay_high_level()
3059 * do not allow overlay_base to duplicate any node already in in of_unittest_overlay_high_level()
3064 * remove overlay_base_root node "__local_fixups", after in of_unittest_overlay_high_level()
3067 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3068 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3070 *pprev = np->sibling; in of_unittest_overlay_high_level()
3073 pprev = &np->sibling; in of_unittest_overlay_high_level()
3076 /* remove overlay_base_root node "__symbols__" if in live tree */ in of_unittest_overlay_high_level()
3079 /* will have to graft properties from node into live tree */ in of_unittest_overlay_high_level()
3080 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3081 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3084 *pprev = np->sibling; in of_unittest_overlay_high_level()
3087 pprev = &np->sibling; in of_unittest_overlay_high_level()
3094 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3095 unittest(0, "illegal node name in overlay_base %pOFn", in of_unittest_overlay_high_level()
3106 * root node of *overlay_base_root will not be freed, it is lost in of_unittest_overlay_high_level()
3110 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3111 np->parent = of_root; in of_unittest_overlay_high_level()
3115 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3119 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3121 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3127 struct property *new_prop; in of_unittest_overlay_high_level()
3132 unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__", in of_unittest_overlay_high_level()
3133 prop->name); in of_unittest_overlay_high_level()
3137 kfree(new_prop->name); in of_unittest_overlay_high_level()
3138 kfree(new_prop->value); in of_unittest_overlay_high_level()
3140 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
3141 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
3143 unittest(0, "duplicate property '%s' in overlay_base node __symbols__", in of_unittest_overlay_high_level()
3144 prop->name); in of_unittest_overlay_high_level()
3148 unittest(0, "unable to add property '%s' in overlay_base node __symbols__ to sysfs", in of_unittest_overlay_high_level()
3149 prop->name); in of_unittest_overlay_high_level()
3161 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3163 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3165 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3167 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3169 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3171 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3173 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3175 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3177 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3179 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3181 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3186 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3188 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3190 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3192 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3194 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3196 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3198 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3200 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3202 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3204 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3206 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3211 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3213 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3219 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3221 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3224 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3226 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3228 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3234 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3236 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3238 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3263 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
3276 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
3307 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()