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 */
29 #include <linux/i2c-mux.h>
54 #define OF_KREF_READ(NODE) kref_read(&(NODE)->kobj.kref) argument
56 #define OF_KREF_READ(NODE) 1 argument
60 * Expected message may have a message level other than KERN_INFO.
85 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
87 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
88 "find /testcase-data failed\n"); 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()
98 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
99 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
103 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
105 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
106 "find testcase-alias failed\n"); 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()
116 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
117 "find testcase-alias/phandle-tests/consumer-a failed\n"); 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()
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()
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()
133 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); 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()
143 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); 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()
152 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", 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()
164 np = of_find_node_opts_by_path("testcase-alias/phandle-tests/consumer-a:testaliasoption", 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()
173 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); 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()
184 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
191 struct property *prop; in of_unittest_dynamic()
193 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
206 /* Add a new property - should pass*/ in of_unittest_dynamic()
207 prop->name = "new-property"; in of_unittest_dynamic()
208 prop->value = "new-property-data"; in of_unittest_dynamic()
209 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
210 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
212 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
214 prop->name = "new-property"; in of_unittest_dynamic()
215 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
216 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
218 "Adding an existing property should have failed\n"); in of_unittest_dynamic()
220 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
221 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
222 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
224 "Updating an existing property should have passed\n"); in of_unittest_dynamic()
226 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
228 prop->name = "modify-property"; in of_unittest_dynamic()
229 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
230 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
232 "Updating a missing property should have passed\n"); in of_unittest_dynamic()
234 /* Remove property - should pass */ in of_unittest_dynamic()
236 "Removing a property should have passed\n"); in of_unittest_dynamic()
238 /* Adding very large property - should pass */ in of_unittest_dynamic()
240 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
241 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
242 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
243 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
244 if (prop->value) in of_unittest_dynamic()
246 "Adding a large property should have passed\n"); in of_unittest_dynamic()
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()
255 pr_err("Child node %pOFn links to wrong parent %pOFn\n", in of_unittest_check_node_linkage()
256 child, np); in of_unittest_check_node_linkage()
257 return -EINVAL; in of_unittest_check_node_linkage()
260 rc = of_unittest_check_node_linkage(child); in of_unittest_check_node_linkage()
281 unittest(child_count > 0, "Device node data structure is corrupted\n"); in of_unittest_check_tree_linkage()
300 /* Baseline; check conversion with a large size limit */ in of_unittest_printf_one()
302 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
311 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
325 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
334 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
341 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); 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()
353 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
357 struct hlist_node node; member
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()
394 hash_for_each_safe(phandle_ht, i, tmp, nh, node) { in of_unittest_check_phandles()
395 hash_del(&nh->node); in of_unittest_check_phandles()
406 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 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()
420 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
422 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
436 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
461 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
467 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
474 /* Check for missing list property */ 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()
477 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
478 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); 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()
480 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
481 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
483 /* Check for missing cells property */ in of_unittest_parse_phandle_with_args()
487 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
489 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
490 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
493 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
495 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
498 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
500 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
501 "#phandle-cells-missing"); in of_unittest_parse_phandle_with_args()
504 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
506 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
512 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); 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()
515 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
518 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
520 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
523 "OF: /testcase-data/phandle-tests/consumer-a: could not find 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()
526 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
529 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
531 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
537 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); 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()
540 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
543 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
545 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
548 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); 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()
551 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
554 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
556 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
566 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
572 p[0] = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
573 p[1] = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
574 p[2] = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
575 p[3] = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); in of_unittest_parse_phandle_with_args_map()
576 p[4] = of_find_node_by_path("/testcase-data/phandle-tests/provider4"); in of_unittest_parse_phandle_with_args_map()
577 p[5] = of_find_node_by_path("/testcase-data/phandle-tests/provider5"); 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()
596 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
613 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
647 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
653 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
654 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
660 /* Check for missing list property */ 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()
664 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
666 /* Check for missing cells,map,mask property */ in of_unittest_parse_phandle_with_args_map()
670 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… 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()
673 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
675 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
677 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
683 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); 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()
688 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); in of_unittest_parse_phandle_with_args_map()
690 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
696 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); 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()
701 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); in of_unittest_parse_phandle_with_args_map()
703 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
719 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 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()
732 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
733 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
734 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
735 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
736 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
737 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
738 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); 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()
746 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
747 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
748 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); 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()
755 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… 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()
764 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
766 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
767 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … 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()
772 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … 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()
781 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
782 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
783 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
784 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
785 /* -- parsing the correctly formed strings should still work: */ 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()
794 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
795 (p1)->value && (p2)->value && \
796 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
797 !strcmp((p1)->name, (p2)->name))
801 struct property p1 = { .name = "p1", .length = 0, .value = "" }; in of_unittest_property_copy()
802 struct property p2 = { .name = "p2", .length = 5, .value = "abcd" }; in of_unittest_property_copy()
803 struct property *new; in of_unittest_property_copy()
806 unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n"); in of_unittest_property_copy()
810 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
819 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
820 struct property *ppname_n1, pname_n1 = { .name = "name", .length = 3, .value = "n1" }; in of_unittest_changeset()
821 struct property *ppname_n2, pname_n2 = { .name = "name", .length = 3, .value = "n2" }; in of_unittest_changeset()
822 struct property *ppname_n21, pname_n21 = { .name = "name", .length = 3, .value = "n21" }; in of_unittest_changeset()
823 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
824 struct property *ppremove; in of_unittest_changeset()
840 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
841 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
860 n1->parent = parent; in of_unittest_changeset()
861 n2->parent = parent; in of_unittest_changeset()
862 n21->parent = n2; in of_unittest_changeset()
864 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
875 unittest(!of_changeset_detach_node(&chgset, nremove), "fail remove node\n"); in of_unittest_changeset()
880 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
885 unittest(!of_changeset_add_prop_string(&chgset, n22, "prop-str", "abcd"), in of_unittest_changeset()
886 "fail add prop prop-str"); in of_unittest_changeset()
887 unittest(!of_changeset_add_prop_string_array(&chgset, n22, "prop-str-array", in of_unittest_changeset()
890 "fail add prop prop-str-array"); in of_unittest_changeset()
891 unittest(!of_changeset_add_prop_u32_array(&chgset, n22, "prop-u32-array", in of_unittest_changeset()
893 "fail add prop prop-u32-array"); in of_unittest_changeset()
899 /* Make sure node names are constructed correctly */ in of_unittest_changeset()
900 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
903 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n22")), in of_unittest_changeset()
909 unittest(!of_find_node_by_path("/testcase-data/changeset/n2/n21"), in of_unittest_changeset()
912 unittest(of_property_present(parent, "prop-remove"), in of_unittest_changeset()
915 ret = of_property_read_string(parent, "prop-update", &propstr); in of_unittest_changeset()
918 unittest(strcmp(propstr, "hello") == 0, "original value not in updated property after revert"); in of_unittest_changeset()
1037 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset_prop()
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()
1050 unittest(ret == 0, "failed to add prop-string\n"); in of_unittest_changeset_prop()
1052 ret = of_changeset_add_prop_string_array(&chgset, np, "prop-string-array", in of_unittest_changeset_prop()
1054 unittest(ret == 0, "failed to add prop-string-array\n"); in of_unittest_changeset_prop()
1056 ret = of_changeset_add_prop_u32(&chgset, np, "prop-u32", 1234); in of_unittest_changeset_prop()
1057 unittest(ret == 0, "failed to add prop-u32\n"); in of_unittest_changeset_prop()
1059 ret = of_changeset_add_prop_u32_array(&chgset, np, "prop-u32-array", in of_unittest_changeset_prop()
1061 unittest(ret == 0, "failed to add prop-u32-array\n"); in of_unittest_changeset_prop()
1063 ret = of_changeset_add_prop_bool(&chgset, np, "prop-bool"); in of_unittest_changeset_prop()
1064 unittest(ret == 0, "failed to add prop-bool\n"); 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()
1102 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
1130 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
1144 dev_bogus->dma_range_map = map; in of_unittest_dma_ranges_one()
1149 "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
1152 "of_dma_get_range: wrong DMA addr %pad (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
1164 of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", in of_unittest_parse_dma_ranges()
1167 of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", in of_unittest_parse_dma_ranges()
1169 of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", in of_unittest_parse_dma_ranges()
1183 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
1190 pr_err("missing dma-ranges property\n"); in of_unittest_pci_dma_ranges()
1195 * Get the dma-ranges from the device tree in of_unittest_pci_dma_ranges()
1200 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1203 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1206 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1210 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1213 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1216 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
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()
1241 pr_err("missing dma-ranges property\n"); in of_unittest_pci_empty_dma_ranges()
1246 * Get the dma-ranges from the device tree in of_unittest_pci_empty_dma_ranges()
1250 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_empty_dma_ranges()
1253 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_empty_dma_ranges()
1256 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_empty_dma_ranges()
1271 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1278 pr_err("missing ranges property\n"); in of_unittest_bus_ranges()
1283 unittest(!ret, "of_range_to_resource returned error (%d) node %pOF\n", in of_unittest_bus_ranges()
1286 "of_range_to_resource wrong resource type on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1289 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1292 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1297 "of_range_count wrong size on node %pOF count=%d\n", in of_unittest_bus_ranges()
1305 "for_each_of_range wrong flags on node %pOF flags=%x (expected %x)\n", in of_unittest_bus_ranges()
1309 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1312 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1315 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1319 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1322 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1325 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1341 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); in of_unittest_bus_3cell_ranges()
1348 pr_err("missing ranges property\n"); in of_unittest_bus_3cell_ranges()
1358 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1361 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1364 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1367 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1371 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1374 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1377 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1380 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1396 np = of_find_node_by_path("/testcase-data/address-tests/bus@80000000/device@1000"); in of_unittest_reg()
1410 np = of_find_node_by_path("/testcase-data/platform-tests-2/node/test-device@100"); in of_unittest_reg()
1417 unittest(ret == -EINVAL, "of_address_to_resource(%pOF) expected error on untranslatable address\n", in of_unittest_reg()
1450 while (count--) { 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()
1454 unittest(resource_type(&res) == resource_type(&expected->res) && in of_unittest_check_addr()
1455 res.start == expected->res.start && in of_unittest_check_addr()
1456 resource_size(&res) == resource_size(&expected->res), in of_unittest_check_addr()
1458 np, expected->index, &res, &expected->res); in of_unittest_check_addr()
1487 of_unittest_check_addr("/testcase-data/address-tests2/bus-2cell@10000000/device@100000", in of_unittest_translate_addr()
1491 …of_unittest_check_addr("/testcase-data/address-tests2/bus-3cell@20000000/local-bus@100000/device@f… in of_unittest_translate_addr()
1495 …of_unittest_check_addr("/testcase-data/address-tests2/pcie@d1070000/pci@0,0/dev@0,0/local-bus@0/de… in of_unittest_translate_addr()
1509 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1525 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1530 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1542 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1571 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1586 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1598 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1638 * Tests child node that is missing property in of_unittest_parse_interrupts_extended()
1639 * #address-cells. See the comments in in of_unittest_parse_interrupts_extended()
1640 * drivers/of/unittest-data/tests-interrupts.dtsi in of_unittest_parse_interrupts_extended()
1641 * nodes intmap1 and interrupts-extended0 in of_unittest_parse_interrupts_extended()
1651 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
1670 intc0 = of_find_node_by_path("/testcase-data/interrupts/intc0"); in of_unittest_irq_refcount()
1671 int_ext0 = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_irq_refcount()
1672 intc_intmap0 = of_find_node_by_path("/testcase-data/interrupts/intc-intmap0"); in of_unittest_irq_refcount()
1673 int2 = of_find_node_by_path("/testcase-data/interrupts/interrupts2"); in of_unittest_irq_refcount()
1724 { .data = "A", .name = "name0", }, /* Name alone is lowest priority */
1744 { .path = "/testcase-data/match-node/name0", .data = "A", },
1745 { .path = "/testcase-data/match-node/name1", .data = "B", },
1746 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1747 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1748 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1749 { .path = "/testcase-data/match-node/name3", .data = "E", },
1750 { .path = "/testcase-data/match-node/name4", .data = "G", },
1751 { .path = "/testcase-data/match-node/name5", .data = "H", },
1752 { .path = "/testcase-data/match-node/name6", .data = "G", },
1753 { .path = "/testcase-data/match-node/name7", .data = "I", },
1754 { .path = "/testcase-data/match-node/name8", .data = "J", },
1755 { .path = "/testcase-data/match-node/name9", .data = "K", },
1767 unittest(0, "missing testcase node %s\n", in of_unittest_match_node()
1779 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1782 (const char *)match->data); in of_unittest_match_node()
1791 .name = "unittest-bus",
1796 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1799 { .compatible = "test-device", }, in of_unittest_platform_populate()
1803 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1806 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1807 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1813 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1814 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1816 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1817 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1822 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1827 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1829 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1830 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1833 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1845 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1848 * Add a dummy resource to the test bus node after it is in of_unittest_platform_populate()
1849 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1856 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1857 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1858 for_each_child_of_node(child, grandchild) { in of_unittest_platform_populate()
1861 "Could not create device for node '%pOFn'\n", in of_unittest_platform_populate()
1867 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1868 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1869 for_each_child_of_node(child, grandchild) in of_unittest_platform_populate()
1880 * update_node_properties - adds the properties
1881 * of np into dup node (present in live tree) and
1884 * @np: node whose properties are being added to the live tree
1885 * @dup: node present in live tree to be updated
1890 struct property *prop; in update_node_properties()
1891 struct property *save_next; in update_node_properties()
1892 struct device_node *child; in update_node_properties() local
1895 for_each_child_of_node(np, child) in update_node_properties()
1896 child->parent = dup; in update_node_properties()
1899 * "unittest internal error: unable to add testdata property" in update_node_properties()
1901 * If this message reports a property in node '/__symbols__' then in update_node_properties()
1902 * the respective unittest overlay contains a label that has the in update_node_properties()
1903 * same name as a label in the live devicetree. The label will in update_node_properties()
1905 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1908 * used in a real devicetree. in update_node_properties()
1913 * sets prop->next to NULL in update_node_properties()
1915 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1916 save_next = prop->next; in update_node_properties()
1919 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1921 pr_err("unittest internal error: unable to add testdata property %pOF/%s", in update_node_properties()
1922 np, prop->name); in update_node_properties()
1928 * attach_node_and_children - attaches nodes
1930 * CAUTION: misleading function name - if node @np already exists in
1933 * nodes do not have child nodes.
1935 * @np: Node to attach to live tree
1939 struct device_node *next, *dup, *child; in attach_node_and_children() local
1960 child = np->child; in attach_node_and_children()
1961 np->child = NULL; in attach_node_and_children()
1965 np->sibling = np->parent->child; in attach_node_and_children()
1966 np->parent->child = np; in attach_node_and_children()
1973 while (child) { in attach_node_and_children()
1974 next = child->sibling; in attach_node_and_children()
1975 attach_node_and_children(child); in attach_node_and_children()
1976 child = next; in attach_node_and_children()
1981 * unittest_data_add - Reads, copies data from
1995 const int size = __dtbo_testcases_end - __dtbo_testcases_begin; in unittest_data_add()
2001 return -ENODATA; in unittest_data_add()
2007 return -ENOMEM; in unittest_data_add()
2016 return -ENODATA; in unittest_data_add()
2021 return -ENODATA; in unittest_data_add()
2033 return -EINVAL; in unittest_data_add()
2036 /* attach the sub-tree to live tree */ in unittest_data_add()
2038 pr_warn("%s: no live tree to attach sub-tree\n", __func__); in unittest_data_add()
2040 return -ENODEV; in unittest_data_add()
2044 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
2046 np = unittest_data_node->child; in unittest_data_add()
2048 struct device_node *next = np->sibling; in unittest_data_add()
2050 np->parent = of_root; in unittest_data_add()
2057 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
2069 struct device *dev = &pdev->dev; in unittest_probe()
2070 struct device_node *np = dev->of_node; in unittest_probe()
2074 return -EINVAL; in unittest_probe()
2078 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
2080 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
2087 struct device *dev = &pdev->dev; in unittest_remove()
2088 struct device_node *np = dev->of_node; in unittest_remove()
2090 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
2123 /* find out if a platform device exists at that path */
2147 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
2161 return -ENOMEM; in unittest_gpio_probe()
2165 devptr->chip.fwnode = dev_fwnode(&pdev->dev); in unittest_gpio_probe()
2166 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
2167 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
2168 devptr->chip.ngpio = 5; in unittest_gpio_probe()
2169 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
2171 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
2174 "gpiochip_add_data() for node @%pfw failed, ret = %d\n", devptr->chip.fwnode, ret); in unittest_gpio_probe()
2184 struct device *dev = &pdev->dev; in unittest_gpio_remove()
2186 dev_dbg(dev, "%s for node @%pfw\n", __func__, devptr->chip.fwnode); in unittest_gpio_remove()
2188 if (devptr->chip.base != -1) in unittest_gpio_remove()
2189 gpiochip_remove(&devptr->chip); in unittest_gpio_remove()
2195 { .compatible = "unittest-gpio", },
2203 .name = "unittest-gpio",
2216 * Similar to installing a driver as a module, the in of_unittest_overlay_gpio()
2224 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
2225 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
2226 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
2227 * - register driver in of_unittest_overlay_gpio()
2230 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
2231 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
2232 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
2239 * overlay_gpio_01 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
2240 * overlay_gpio_02a contains gpio node in of_unittest_overlay_gpio()
2241 * overlay_gpio_02b contains child gpio hog node in of_unittest_overlay_gpio()
2262 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2267 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
2270 * overlay_gpio_03 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
2272 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
2275 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
2281 /* overlay_gpio_03 contains gpio node and child gpio hog node */ in of_unittest_overlay_gpio()
2291 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2294 * overlay_gpio_04a contains gpio node in of_unittest_overlay_gpio()
2296 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
2299 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
2305 /* overlay_gpio_04a contains gpio node */ in of_unittest_overlay_gpio()
2314 * overlay_gpio_04b contains child gpio hog node in of_unittest_overlay_gpio()
2316 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
2319 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
2322 /* overlay_gpio_04b contains child gpio hog node */ in of_unittest_overlay_gpio()
2329 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2359 /* find out if a i2c client device exists at that path */
2366 put_device(&client->dev); in of_path_i2c_client_exists()
2400 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
2403 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
2409 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
2410 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
2433 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
2435 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
2440 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
2463 track_ovcs_id_cnt--; in of_unittest_untrack_overlay()
2476 ovcs_id = track_ovcs_id[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2477 overlay_nr = track_ovcs_id_overlay_nr[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2480 if (ret == -ENODEV) { in of_unittest_remove_tracked_overlays()
2503 return -EFAULT; in of_unittest_apply_overlay()
2522 return -EINVAL; in __of_unittest_apply_overlay_check()
2539 return -EINVAL; in __of_unittest_apply_overlay_check()
2587 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2599 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2605 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2619 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2625 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2640 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2646 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2659 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2665 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2673 /* test activation of a full device node */
2689 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2695 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2729 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2743 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2746 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2760 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2776 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2816 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2825 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2836 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2842 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2856 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2867 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2871 * Should never get here. If we do, expect a lot of in of_unittest_overlay_8()
2882 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2897 /* test insertion of a bus with parent devices */
2910 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2918 unittest(ret, "overlay test %d failed; no child device\n", 10); in of_unittest_overlay_10()
2921 /* test insertion of a bus with parent devices (and revert) */
2962 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2963 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2970 return -EINVAL; in unittest_i2c_bus_probe()
2974 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
2978 return -ENOMEM; in unittest_i2c_bus_probe()
2981 std->pdev = pdev; in unittest_i2c_bus_probe()
2984 adap = &std->adap; in unittest_i2c_bus_probe()
2986 adap->nr = -1; in unittest_i2c_bus_probe()
2987 strscpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2988 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2989 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2990 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2991 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2992 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2993 adap->retries = 3; in unittest_i2c_bus_probe()
3006 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
3007 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
3010 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
3011 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
3015 { .compatible = "unittest-i2c-bus", },
3023 .name = "unittest-i2c-bus",
3030 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
3031 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
3034 dev_err(dev, "No OF node\n"); in unittest_i2c_dev_probe()
3035 return -EINVAL; in unittest_i2c_dev_probe()
3038 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
3045 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
3046 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
3048 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
3052 { .name = "unittest-i2c-dev" },
3058 .name = "unittest-i2c-dev",
3075 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
3076 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
3077 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
3081 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
3084 dev_err(dev, "No OF node\n"); in unittest_i2c_mux_probe()
3085 return -EINVAL; in unittest_i2c_mux_probe()
3088 max_reg = (u32)-1; in unittest_i2c_mux_probe()
3089 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
3090 if (of_property_read_u32(child, "reg", &reg)) in unittest_i2c_mux_probe()
3092 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
3095 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
3098 return -EINVAL; in unittest_i2c_mux_probe()
3104 return -ENOMEM; in unittest_i2c_mux_probe()
3109 return -ENODEV; in unittest_i2c_mux_probe()
3120 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
3121 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
3124 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
3129 { .name = "unittest-i2c-mux" },
3135 .name = "unittest-i2c-mux",
3162 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
3167 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
3192 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
3197 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
3211 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
3217 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
3236 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
3241 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
3267 * ret = -EBUSY which is -16. in of_notify()
3276 of_node_get(nd->overlay); in of_notify()
3281 found = of_find_node_by_name(nd->overlay, "test-unittest16"); in of_notify()
3284 ret = -EBUSY; in of_notify()
3289 found = of_find_node_by_name(nd->overlay, "test-unittest17"); in of_notify()
3292 ret = -EEXIST; in of_notify()
3297 found = of_find_node_by_name(nd->overlay, "test-unittest18"); in of_notify()
3300 ret = -EXDEV; in of_notify()
3305 found = of_find_node_by_name(nd->overlay, "test-unittest19"); in of_notify()
3308 ret = -ENODEV; in of_notify()
3313 of_node_put(nd->overlay); in of_notify()
3314 ret = -EINVAL; in of_notify()
3345 * Applying overlays 16 - 19 will each trigger an error for a in of_unittest_overlay_notify()
3351 /* --- overlay 16 --- */ in of_unittest_overlay_notify()
3353 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3358 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3362 /* --- overlay 17 --- */ in of_unittest_overlay_notify()
3364 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3369 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3373 /* --- overlay 18 --- */ in of_unittest_overlay_notify()
3381 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3384 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3385 if (ret == -EXDEV) { in of_unittest_overlay_notify()
3399 /* --- overlay 19 --- */ in of_unittest_overlay_notify()
3407 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3409 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3410 if (ret == -ENODEV) in of_unittest_overlay_notify()
3421 /* --- overlay 20 --- */ in of_unittest_overlay_notify()
3522 const char *refcount_path = "/testcase-data/refcount-node"; in of_unittest_lifecycle()
3523 const char *refcount_parent_path = "/testcase-data"; in of_unittest_lifecycle()
3526 * Node lifecycle tests, non-dynamic node: in of_unittest_lifecycle()
3528 * - Decrementing refcount to zero via of_node_put() should cause the in of_unittest_lifecycle()
3529 * attempt to free the node memory by of_node_release() to fail in of_unittest_lifecycle()
3530 * because the node is not a dynamic node. in of_unittest_lifecycle()
3532 * - Decrementing refcount past zero should result in additional in of_unittest_lifecycle()
3548 refcount = kref_read(&np->kobj.kref); in of_unittest_lifecycle()
3555 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3558 * refcount is now one, decrementing to zero will result in a call to in of_unittest_lifecycle()
3559 * of_node_release() to free the node's memory, which should result in of_unittest_lifecycle()
3562 unittest(1, "/testcase-data/refcount-node is one"); in of_unittest_lifecycle()
3565 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3576 EXPECT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3578 EXPECT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3579 EXPECT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3582 unittest(1, "/testcase-data/refcount-node is zero"); in of_unittest_lifecycle()
3585 EXPECT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3586 EXPECT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3588 EXPECT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3592 * A. no, the WARNING is from WARN_ONCE() in of_unittest_lifecycle()
3594 EXPECT_NOT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3596 EXPECT_NOT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3597 EXPECT_NOT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3599 unittest(1, "/testcase-data/refcount-node is zero, second time"); in of_unittest_lifecycle()
3602 EXPECT_NOT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3603 EXPECT_NOT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3605 EXPECT_NOT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3609 * attempt to of_node_get() node "refcount-node". One example of in of_unittest_lifecycle()
3612 * of_node_get() of the children of a node. in of_unittest_lifecycle()
3614 * Prevent the stack trace by removing node "refcount-node" from in of_unittest_lifecycle()
3615 * its parent's child list. in of_unittest_lifecycle()
3619 * Directly manipulate the child list of node /testcase-data to in of_unittest_lifecycle()
3620 * remove child refcount-node. This is ignoring all proper methods in of_unittest_lifecycle()
3621 * of removing a child and will leak a small amount of memory. in of_unittest_lifecycle()
3626 unittest(np, "ERROR: devicetree live tree left in a 'bad state' if test fail\n"); in of_unittest_lifecycle()
3630 prev_sibling = np->child; in of_unittest_lifecycle()
3631 next_sibling = prev_sibling->sibling; in of_unittest_lifecycle()
3632 if (!strcmp(prev_sibling->full_name, "refcount-node")) { in of_unittest_lifecycle()
3633 np->child = next_sibling; in of_unittest_lifecycle()
3634 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3637 if (!strcmp(next_sibling->full_name, "refcount-node")) in of_unittest_lifecycle()
3638 prev_sibling->sibling = next_sibling->sibling; in of_unittest_lifecycle()
3640 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3716 OVERLAY_INFO(overlay_base, -9999, 0),
3733 OVERLAY_INFO(overlay_16, -EBUSY, 0),
3734 OVERLAY_INFO(overlay_17, -EEXIST, 0),
3745 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL, -ENODEV),
3746 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL, -ENODEV),
3747 OVERLAY_INFO(overlay_bad_phandle, -EINVAL, 0),
3748 OVERLAY_INFO(overlay_bad_symbol, -EINVAL, -ENODEV),
3749 OVERLAY_INFO(overlay_bad_unresolved, -EINVAL, 0),
3784 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
3785 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
3797 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
3802 data_size = info->dtbo_end - info->dtbo_begin; in unittest_unflatten_overlay_base()
3808 size = fdt_totalsize(info->dtbo_begin); in unittest_unflatten_overlay_base()
3820 memcpy(new_fdt, info->dtbo_begin, size); in unittest_unflatten_overlay_base()
3828 * overlay in the normal fashion. This is a test of the whole
3831 * A secondary purpose is to be able to verify that the contents of
3832 * /proc/device-tree/ contains the updated structure and values from
3845 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
3846 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3856 size = info->dtbo_end - info->dtbo_begin; in overlay_data_apply()
3860 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id, in overlay_data_apply()
3863 *ovcs_id = info->ovcs_id; in overlay_data_apply()
3870 if (ret != info->expected_result) { in overlay_data_apply()
3872 info->expected_result, ret, overlay_name); in overlay_data_apply()
3878 ret2 = of_overlay_remove(&info->ovcs_id); in overlay_data_apply()
3879 if (ret2 != info->expected_result_remove) { in overlay_data_apply()
3881 info->expected_result_remove, ret2, in overlay_data_apply()
3892 * in the normal fashion. This is a test of the whole picture,
3905 struct property *prop; in of_unittest_overlay_high_level()
3923 * do not allow overlay_base to duplicate any node already in in of_unittest_overlay_high_level()
3928 * remove overlay_base_root node "__local_fixups", after in of_unittest_overlay_high_level()
3931 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3932 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3934 *pprev = np->sibling; in of_unittest_overlay_high_level()
3937 pprev = &np->sibling; in of_unittest_overlay_high_level()
3940 /* remove overlay_base_root node "__symbols__" if in live tree */ in of_unittest_overlay_high_level()
3943 /* will have to graft properties from node into live tree */ in of_unittest_overlay_high_level()
3944 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3945 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3948 *pprev = np->sibling; in of_unittest_overlay_high_level()
3951 pprev = &np->sibling; in of_unittest_overlay_high_level()
3958 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3959 unittest(0, "illegal node name in overlay_base %pOFn", in of_unittest_overlay_high_level()
3972 * root node of *overlay_base_root will not be freed, it is lost in of_unittest_overlay_high_level()
3976 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3977 np->parent = of_root; in of_unittest_overlay_high_level()
3981 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3985 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3987 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3993 struct property *new_prop; in of_unittest_overlay_high_level()
3998 unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__", in of_unittest_overlay_high_level()
3999 prop->name); in of_unittest_overlay_high_level()
4004 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
4005 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
4007 unittest(0, "duplicate property '%s' in overlay_base node __symbols__", in of_unittest_overlay_high_level()
4008 prop->name); in of_unittest_overlay_high_level()
4012 unittest(0, "unable to add property '%s' in overlay_base node __symbols__ to sysfs", in of_unittest_overlay_high_level()
4013 prop->name); in of_unittest_overlay_high_level()
4024 /* --- overlay --- */ in of_unittest_overlay_high_level()
4027 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
4029 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
4031 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
4033 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
4035 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4037 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4039 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4041 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
4043 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
4045 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
4047 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
4052 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
4054 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
4056 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
4058 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
4060 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4062 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4064 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4066 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
4068 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
4070 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
4072 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
4076 /* --- overlay_bad_add_dup_node --- */ in of_unittest_overlay_high_level()
4079 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
4081 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4083 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
4085 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4091 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4093 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
4095 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4097 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
4099 /* --- overlay_bad_add_dup_prop --- */ in of_unittest_overlay_high_level()
4102 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
4104 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4106 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4108 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
4110 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4116 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4118 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
4120 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4122 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
4124 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
4126 /* --- overlay_bad_phandle --- */ in of_unittest_overlay_high_level()
4131 /* --- overlay_bad_symbol --- */ in of_unittest_overlay_high_level()
4134 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
4136 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4142 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4144 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
4146 /* --- overlay_bad_unresolved --- */ in of_unittest_overlay_high_level()
4149 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
4151 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
4157 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
4159 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
4171 * PCI device tree node test driver
4185 dn = pdev->dev.of_node; in testdrv_probe()
4187 dev_err(&pdev->dev, "does not find bus endpoint"); in testdrv_probe()
4188 return -EINVAL; in testdrv_probe()
4191 for (info = overlays; info && info->name; info++) { in testdrv_probe()
4192 if (!strcmp(info->name, "overlay_pci_node")) in testdrv_probe()
4195 if (!info || !info->name) { in testdrv_probe()
4196 dev_err(&pdev->dev, "no overlay data for overlay_pci_node"); in testdrv_probe()
4197 return -ENODEV; in testdrv_probe()
4200 size = info->dtbo_end - info->dtbo_begin; in testdrv_probe()
4201 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &ovcs_id, dn); in testdrv_probe()
4206 of_platform_default_populate(dn, NULL, &pdev->dev); in testdrv_probe()
4216 of_platform_depopulate(&pdev->dev); in testdrv_remove()
4235 return -ENODEV; in unittest_pci_probe()
4237 dev = &pdev->dev; in unittest_pci_probe()
4239 dev = dev->parent; in unittest_pci_probe()
4242 return -ENODEV; in unittest_pci_probe()
4246 unittest(res->start == exp_addr, "Incorrect translated address %llx, expected %llx\n", in unittest_pci_probe()
4247 (u64)res->start, exp_addr); in unittest_pci_probe()
4255 { .compatible = "unittest-pci" },
4262 .name = "unittest-pci",
4275 pnp = pdev->dev.of_node; in of_unittest_pci_node_verify()
4276 unittest(pnp, "Failed creating PCI dt node\n"); in of_unittest_pci_node_verify()
4278 return -ENODEV; in of_unittest_pci_node_verify()
4281 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0/unittest-pci@100", pnp); in of_unittest_pci_node_verify()
4283 unittest(np, "Failed to get unittest-pci node under PCI node\n"); in of_unittest_pci_node_verify()
4285 rc = -ENODEV; in of_unittest_pci_node_verify()
4290 unittest(reg, "Failed to get reg property\n"); in of_unittest_pci_node_verify()
4292 rc = -ENODEV; in of_unittest_pci_node_verify()
4294 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0", pnp); in of_unittest_pci_node_verify()
4296 unittest(!np, "Child device tree node is not removed\n"); in of_unittest_pci_node_verify()
4297 child_dev = device_find_any_child(&pdev->dev); in of_unittest_pci_node_verify()
4298 unittest(!child_dev, "Child device is not removed\n"); in of_unittest_pci_node_verify()
4336 "No test PCI device been found. Please run QEMU with '-device pci-testdev'\n"); in of_unittest_pci_node()
4338 "Child device number %d is not expected %d", of_unittest_pci_child_num, in of_unittest_pci_node()
4361 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
4373 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
4413 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()