Lines Matching +full:i +full:- +full:leak +full:- +full:current

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>
45 pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
48 pr_info("pass %s():%i\n", __func__, __LINE__); \
54 #define OF_KREF_READ(NODE) kref_read(&(NODE)->kobj.kref)
61 * Print the expected message only if the current loglevel will allow
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()
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()
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()
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()
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()
234 /* Remove property - should pass */ 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()
254 if (child->parent != np) { in of_unittest_check_node_linkage()
257 return -EINVAL; in of_unittest_check_node_linkage()
283 "allnodes list size (%i) doesn't match sibling lists size (%i)\n", in of_unittest_check_tree_linkage()
285 pr_debug("allnodes list size (%i); sibling lists size (%i)\n", allnode_count, child_count); in of_unittest_check_tree_linkage()
293 int size, i; in of_unittest_printf_one() local
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()
316 "snprintf failed; size=%i fmt='%s' expected='%s' rslt='%s'\n", 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()
367 int i, dup_count = 0, phandle_count = 0; in of_unittest_check_phandles() local
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()
375 pr_info("Duplicate phandle! %i used by %pOF and %pOF\n", 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()
390 unittest(dup_count == 0, "Found %i duplicates in %i phandles\n", 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()
404 int i, rc; in of_unittest_parse_phandle_with_args() local
406 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
412 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
413 unittest(rc == 7, "of_count_phandle_with_args() returned %i, expected 7\n", rc); in of_unittest_parse_phandle_with_args()
415 for (i = 0; i < 8; i++) { 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()
423 switch (i) { in of_unittest_parse_phandle_with_args()
427 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
432 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
436 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
441 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
448 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
458 passed &= (args.args[0] == (i + 1)); 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()
468 i, args.np, rc); 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()
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()
564 int i, rc; in of_unittest_parse_phandle_with_args_map() local
566 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
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()
578 for (i = 0; i < ARRAY_SIZE(p); ++i) { in of_unittest_parse_phandle_with_args_map()
579 if (!p[i]) { in of_unittest_parse_phandle_with_args_map()
583 prefs[i] = OF_KREF_READ(p[i]); 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()
587 unittest(rc == 8, "of_count_phandle_with_args() returned %i, expected 8\n", rc); in of_unittest_parse_phandle_with_args_map()
589 for (i = 0; i < 9; i++) { 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()
594 "phandle", i, &args); in of_unittest_parse_phandle_with_args_map()
596 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
597 switch (i) { 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()
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()
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()
705 for (i = 0; i < ARRAY_SIZE(p); ++i) { in of_unittest_parse_phandle_with_args_map()
706 unittest(prefs[i] == OF_KREF_READ(p[i]), in of_unittest_parse_phandle_with_args_map()
708 i, prefs[i], OF_KREF_READ(p[i])); in of_unittest_parse_phandle_with_args_map()
709 of_node_put(p[i]); 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()
726 unittest(rc == 0, "first expected:0 got:%i\n", rc); in of_unittest_property_string()
727 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
728 unittest(rc == 1, "second expected:1 got:%i\n", rc); in of_unittest_property_string()
729 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
730 unittest(rc == 2, "third expected:2 got:%i\n", rc); 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()
742 unittest(rc == 1, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
743 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
744 unittest(rc == 3, "Incorrect string count; rc=%i\n", rc); 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()
752 …unittest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i 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()
757 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
758 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
759 …unittest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i in of_unittest_property_string()
760 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
761 …unittest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\… 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()
769 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… 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()
777 unittest(rc == 1, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
778 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
779 unittest(rc == 3, "Incorrect string count; rc=%i\n", rc); 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()
788 unittest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc); in of_unittest_property_string()
790 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
791 …unittest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, st… 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))
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()
823 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; 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()
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()
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()
951 unsigned int i; in changeset_check_string_array() local
964 for (i = 0; i < count; i++) { in changeset_check_string_array()
965 ret = of_property_read_string_index(np, prop_name, i, &str); in changeset_check_string_array()
966 if (unittest(ret == 0, "failed to read %s[%d]\n", prop_name, i)) in changeset_check_string_array()
969 unittest(strcmp(str, expected_array[i]) == 0, in changeset_check_string_array()
971 prop_name, i, str, expected_array[i]); in changeset_check_string_array()
996 unsigned int i; in changeset_check_u32_array() local
1010 for (i = 0; i < count; i++) { in changeset_check_u32_array()
1011 ret = of_property_read_u32_index(np, prop_name, i, &val32); in changeset_check_u32_array()
1012 if (unittest(ret == 0, "failed to read %s[%d]\n", prop_name, i)) in changeset_check_u32_array()
1015 unittest(val32 == expected_array[i], in changeset_check_u32_array()
1017 prop_name, i, val32, expected_array[i]); in changeset_check_u32_array()
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()
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()
1178 int i = 0; in of_unittest_pci_dma_ranges() local
1183 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
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()
1198 if (!i) { in of_unittest_pci_dma_ranges()
1219 i++; 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()
1269 int ret, count, i = 0; in of_unittest_bus_ranges() local
1271 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1307 if (!i) { in of_unittest_bus_ranges()
1328 i++; in of_unittest_bus_ranges()
1339 int i = 0; in of_unittest_bus_3cell_ranges() local
1341 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); in of_unittest_bus_3cell_ranges()
1356 if (!i) { in of_unittest_bus_3cell_ranges()
1383 i++; 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()
1504 int i, rc; in of_unittest_parse_interrupts() local
1509 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1515 for (i = 0; i < 4; i++) { in of_unittest_parse_interrupts()
1519 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1523 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_interrupts()
1525 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1526 i, args.np, rc); in of_unittest_parse_interrupts()
1530 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1536 for (i = 0; i < 4; i++) { in of_unittest_parse_interrupts()
1540 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1542 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1543 switch (i) { in of_unittest_parse_interrupts()
1571 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1572 i, args.np, rc); in of_unittest_parse_interrupts()
1581 int i, rc; in of_unittest_parse_interrupts_extended() local
1586 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1592 for (i = 0; i < 7; i++) { in of_unittest_parse_interrupts_extended()
1596 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
1598 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1599 switch (i) { 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()
1652 i, args.np, rc); 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()
1734 { .data = "I", .compatible = "compat2", .type = "type1", },
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", },
1762 int i; in of_unittest_match_node() local
1764 for (i = 0; i < ARRAY_SIZE(match_node_tests); i++) { in of_unittest_match_node()
1765 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
1768 match_node_tests[i].path); in of_unittest_match_node()
1775 match_node_tests[i].path); in of_unittest_match_node()
1779 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1781 match_node_tests[i].path, match_node_tests[i].data, in of_unittest_match_node()
1782 (const char *)match->data); in of_unittest_match_node()
1791 .name = "unittest-bus",
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()
1840 unittest(!rc, "testbus registration failed; rc=%i\n", rc); in of_unittest_platform_populate()
1845 test_bus->dev.of_node = np; 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()
1867 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1880 * update_node_properties - adds the properties
1896 child->parent = dup; in update_node_properties()
1905 * compiled with the '-@' option. If you encounter this error, 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()
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
1932 * tree. This works for the current test devicetree nodes because such
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()
1974 next = child->sibling; 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()
2031 pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc); 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()
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()
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",
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()
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()
2272 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
2275 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
2291 unittest_gpio_chip_request_count - chip_request_count); 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()
2316 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
2319 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
2329 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
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 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_0()
2605 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_0()
2619 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_1()
2625 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_1()
2640 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_2()
2646 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_2()
2659 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_3()
2665 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_3()
2689 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_5()
2695 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_5()
2706 int i, save_ovcs_id[2], ovcs_id; in of_unittest_overlay_6() local
2714 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2715 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2718 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2719 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2729 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_6()
2743 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_6()
2746 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_6()
2760 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_6()
2763 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2765 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2768 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2769 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2776 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2777 ovcs_id = save_ovcs_id[i]; in of_unittest_overlay_6()
2780 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2781 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2785 of_unittest_untrack_overlay(save_ovcs_id[i]); in of_unittest_overlay_6()
2788 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2790 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2793 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2794 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2808 int i, save_ovcs_id[2], ovcs_id; in of_unittest_overlay_8() local
2816 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_8()
2825 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay in of_unittest_overlay_8()
2836 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/t… in of_unittest_overlay_8()
2842 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/t… 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()
2882 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2883 ovcs_id = save_ovcs_id[i]; in of_unittest_overlay_8()
2886 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_8()
2891 of_unittest_untrack_overlay(save_ovcs_id[i]); in of_unittest_overlay_8()
2910 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
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()
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()
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()
3035 return -EINVAL; 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()
3052 { .name = "unittest-i2c-dev" },
3058 .name = "unittest-i2c-dev",
3074 int i, nchans; in unittest_i2c_mux_probe() local
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()
3085 return -EINVAL; in unittest_i2c_mux_probe()
3088 max_reg = (u32)-1; 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()
3105 for (i = 0; i < nchans; i++) { in unittest_i2c_mux_probe()
3106 if (i2c_mux_add_adapter(muxc, 0, i)) { in unittest_i2c_mux_probe()
3107 dev_err(dev, "Failed to register mux #%d\n", i); 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()
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 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_12()
3197 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_12()
3211 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_13()
3217 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… 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()
3442 unsigned int i; in of_unittest_overlay() local
3480 for (i = 0; i < 3; i++) in of_unittest_overlay()
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()
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()
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()
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()
3614 * Prevent the stack trace by removing node "refcount-node" from 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()
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()
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()
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()
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()
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()
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()
4008 prop->name); 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 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairw… in of_unittest_overlay_high_level()
4031 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway- in of_unittest_overlay_high_level()
4033 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway- 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 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway- in of_unittest_overlay_high_level()
4068 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway- in of_unittest_overlay_high_level()
4070 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairw… 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 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4081 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… 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 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4097 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4099 /* --- overlay_bad_add_dup_prop --- */ in of_unittest_overlay_high_level()
4102 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4104 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4106 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… 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 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4122 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4124 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… 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()
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()
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()
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()
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()
4297 child_dev = device_find_any_child(&pdev->dev); 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()
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()