Lines Matching +full:i2c +full:- +full:alias
1 // SPDX-License-Identifier: GPL-2.0
6 #define pr_fmt(fmt) "### dt-test ### " fmt
10 #include <linux/dma-direct.h> /* to test phys_to_dma/dma_to_phys */
28 #include <linux/i2c.h>
29 #include <linux/i2c-mux.h>
54 #define OF_KREF_READ(NODE) kref_read(&(NODE)->kobj.kref)
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()
155 "option alias path test failed\n"); in of_unittest_find_node_by_name()
158 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
160 unittest(np && !strcmp("test/alias/option", options), in of_unittest_find_node_by_name()
161 "option alias path test, subcase #1 failed\n"); 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()
169 "option alias path test, subcase #2 failed\n"); in of_unittest_find_node_by_name()
173 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
174 unittest(np, "NULL option alias path test failed\n"); in of_unittest_find_node_by_name()
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()
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()
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()
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()
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()
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()
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()
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))
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()
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()
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()
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()
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()
1271 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1341 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); 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()
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()
1678 { .path = "/testcase-data/match-node/name0", .data = "A", },
1679 { .path = "/testcase-data/match-node/name1", .data = "B", },
1680 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1681 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1682 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1683 { .path = "/testcase-data/match-node/name3", .data = "E", },
1684 { .path = "/testcase-data/match-node/name4", .data = "G", },
1685 { .path = "/testcase-data/match-node/name5", .data = "H", },
1686 { .path = "/testcase-data/match-node/name6", .data = "G", },
1687 { .path = "/testcase-data/match-node/name7", .data = "I", },
1688 { .path = "/testcase-data/match-node/name8", .data = "J", },
1689 { .path = "/testcase-data/match-node/name9", .data = "K", },
1713 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1716 (const char *)match->data); in of_unittest_match_node()
1725 .name = "unittest-bus",
1733 { .compatible = "test-device", }, in of_unittest_platform_populate()
1737 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1740 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1741 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1747 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1748 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1750 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1751 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1756 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1761 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1763 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1764 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1767 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1779 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1783 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1790 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1801 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1814 * update_node_properties - adds the properties
1830 child->parent = dup; in update_node_properties()
1839 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1847 * sets prop->next to NULL in update_node_properties()
1849 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1850 save_next = prop->next; in update_node_properties()
1853 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1856 np, prop->name); in update_node_properties()
1862 * attach_node_and_children - attaches nodes
1864 * CAUTION: misleading function name - if node @np already exists in
1894 child = np->child; in attach_node_and_children()
1895 np->child = NULL; in attach_node_and_children()
1899 np->sibling = np->parent->child; in attach_node_and_children()
1900 np->parent->child = np; in attach_node_and_children()
1908 next = child->sibling; in attach_node_and_children()
1915 * unittest_data_add - Reads, copies data from
1929 const int size = __dtbo_testcases_end - __dtbo_testcases_begin; in unittest_data_add()
1935 return -ENODATA; in unittest_data_add()
1941 return -ENOMEM; in unittest_data_add()
1950 return -ENODATA; in unittest_data_add()
1955 return -ENODATA; in unittest_data_add()
1967 return -EINVAL; in unittest_data_add()
1970 /* attach the sub-tree to live tree */ in unittest_data_add()
1972 pr_warn("%s: no live tree to attach sub-tree\n", __func__); in unittest_data_add()
1974 return -ENODEV; in unittest_data_add()
1978 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1980 np = unittest_data_node->child; in unittest_data_add()
1982 struct device_node *next = np->sibling; in unittest_data_add()
1984 np->parent = of_root; in unittest_data_add()
1991 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
2003 struct device *dev = &pdev->dev; in unittest_probe()
2004 struct device_node *np = dev->of_node; in unittest_probe()
2008 return -EINVAL; in unittest_probe()
2014 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
2021 struct device *dev = &pdev->dev; in unittest_remove()
2022 struct device_node *np = dev->of_node; in unittest_remove()
2081 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
2095 return -ENOMEM; in unittest_gpio_probe()
2099 devptr->chip.fwnode = dev_fwnode(&pdev->dev); in unittest_gpio_probe()
2100 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
2101 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
2102 devptr->chip.ngpio = 5; in unittest_gpio_probe()
2103 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
2105 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
2108 "gpiochip_add_data() for node @%pfw failed, ret = %d\n", devptr->chip.fwnode, ret); in unittest_gpio_probe()
2118 struct device *dev = &pdev->dev; in unittest_gpio_remove()
2120 dev_dbg(dev, "%s for node @%pfw\n", __func__, devptr->chip.fwnode); in unittest_gpio_remove()
2122 if (devptr->chip.base != -1) in unittest_gpio_remove()
2123 gpiochip_remove(&devptr->chip); in unittest_gpio_remove()
2129 { .compatible = "unittest-gpio", },
2137 .name = "unittest-gpio",
2158 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
2159 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
2160 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
2161 * - register driver in of_unittest_overlay_gpio()
2164 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
2165 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
2166 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
2196 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2201 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
2206 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
2209 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
2225 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2230 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
2233 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
2250 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
2253 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
2263 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2277 /* get the i2c client device instantiated at the path */
2293 /* find out if a i2c client device exists at that path */
2300 put_device(&client->dev); in of_path_i2c_client_exists()
2334 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
2337 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
2343 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
2344 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
2367 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
2369 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
2374 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
2397 track_ovcs_id_cnt--; in of_unittest_untrack_overlay()
2410 ovcs_id = track_ovcs_id[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2411 overlay_nr = track_ovcs_id_overlay_nr[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2414 if (ret == -ENODEV) { in of_unittest_remove_tracked_overlays()
2437 return -EFAULT; in of_unittest_apply_overlay()
2456 return -EINVAL; in __of_unittest_apply_overlay_check()
2473 return -EINVAL; in __of_unittest_apply_overlay_check()
2521 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2533 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_0()
2539 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_0()
2553 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_1()
2559 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_1()
2574 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_2()
2580 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_2()
2593 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_3()
2599 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_3()
2623 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_5()
2629 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_5()
2663 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_6()
2677 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_6()
2680 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_6()
2694 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_6()
2710 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2750 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2759 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2770 …will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/prope… in of_unittest_overlay_8()
2776 …will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unittest8/prope… in of_unittest_overlay_8()
2790 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2801 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2816 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2844 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2896 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2897 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2904 return -EINVAL; in unittest_i2c_bus_probe()
2912 return -ENOMEM; in unittest_i2c_bus_probe()
2915 std->pdev = pdev; in unittest_i2c_bus_probe()
2918 adap = &std->adap; in unittest_i2c_bus_probe()
2920 adap->nr = -1; in unittest_i2c_bus_probe()
2921 strscpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2922 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2923 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2924 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2925 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2926 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2927 adap->retries = 3; in unittest_i2c_bus_probe()
2931 dev_err(dev, "Failed to add I2C adapter\n"); in unittest_i2c_bus_probe()
2940 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
2941 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
2945 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
2949 { .compatible = "unittest-i2c-bus", },
2957 .name = "unittest-i2c-bus",
2964 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
2965 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
2969 return -EINVAL; in unittest_i2c_dev_probe()
2979 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
2980 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
2986 { .name = "unittest-i2c-dev" },
2992 .name = "unittest-i2c-dev",
3009 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
3010 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
3011 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe()
3019 return -EINVAL; in unittest_i2c_mux_probe()
3022 max_reg = (u32)-1; in unittest_i2c_mux_probe()
3026 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
3029 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
3032 return -EINVAL; in unittest_i2c_mux_probe()
3038 return -ENOMEM; in unittest_i2c_mux_probe()
3043 return -ENODEV; in unittest_i2c_mux_probe()
3054 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
3055 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
3063 { .name = "unittest-i2c-mux" },
3069 .name = "unittest-i2c-mux",
3084 "could not register unittest i2c device driver\n")) in of_unittest_overlay_i2c_init()
3090 "could not register unittest i2c bus driver\n")) in of_unittest_overlay_i2c_init()
3096 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
3101 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
3104 "could not register unittest i2c mux driver\n")) in of_unittest_overlay_i2c_init()
3126 …ak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test… in of_unittest_overlay_i2c_12()
3131 …ak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test… in of_unittest_overlay_i2c_12()
3145 …ak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test… in of_unittest_overlay_i2c_13()
3151 …ak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-test-bus/test… in of_unittest_overlay_i2c_13()
3159 /* just check for i2c mux existence */
3170 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
3175 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
3201 * ret = -EBUSY which is -16. in of_notify()
3210 of_node_get(nd->overlay); in of_notify()
3215 found = of_find_node_by_name(nd->overlay, "test-unittest16"); in of_notify()
3218 ret = -EBUSY; in of_notify()
3223 found = of_find_node_by_name(nd->overlay, "test-unittest17"); in of_notify()
3226 ret = -EEXIST; in of_notify()
3231 found = of_find_node_by_name(nd->overlay, "test-unittest18"); in of_notify()
3234 ret = -EXDEV; in of_notify()
3239 found = of_find_node_by_name(nd->overlay, "test-unittest19"); in of_notify()
3242 ret = -ENODEV; in of_notify()
3247 of_node_put(nd->overlay); in of_notify()
3248 ret = -EINVAL; in of_notify()
3279 * Applying overlays 16 - 19 will each trigger an error for a in of_unittest_overlay_notify()
3285 /* --- overlay 16 --- */ in of_unittest_overlay_notify()
3287 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3292 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3296 /* --- overlay 17 --- */ in of_unittest_overlay_notify()
3298 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3303 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3307 /* --- overlay 18 --- */ in of_unittest_overlay_notify()
3315 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3318 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3319 if (ret == -EXDEV) { in of_unittest_overlay_notify()
3333 /* --- overlay 19 --- */ in of_unittest_overlay_notify()
3341 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3343 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3344 if (ret == -ENODEV) in of_unittest_overlay_notify()
3355 /* --- overlay 20 --- */ in of_unittest_overlay_notify()
3423 if (unittest(of_unittest_overlay_i2c_init() == 0, "i2c init failed\n")) in of_unittest_overlay()
3456 const char *refcount_path = "/testcase-data/refcount-node"; in of_unittest_lifecycle()
3457 const char *refcount_parent_path = "/testcase-data"; in of_unittest_lifecycle()
3460 * Node lifecycle tests, non-dynamic node: in of_unittest_lifecycle()
3462 * - Decrementing refcount to zero via of_node_put() should cause the in of_unittest_lifecycle()
3466 * - Decrementing refcount past zero should result in additional in of_unittest_lifecycle()
3482 refcount = kref_read(&np->kobj.kref); in of_unittest_lifecycle()
3489 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3496 unittest(1, "/testcase-data/refcount-node is one"); in of_unittest_lifecycle()
3499 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3510 EXPECT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3512 EXPECT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3513 EXPECT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3516 unittest(1, "/testcase-data/refcount-node is zero"); in of_unittest_lifecycle()
3519 EXPECT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3520 EXPECT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3522 EXPECT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3528 EXPECT_NOT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3530 EXPECT_NOT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3531 EXPECT_NOT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3533 unittest(1, "/testcase-data/refcount-node is zero, second time"); in of_unittest_lifecycle()
3536 EXPECT_NOT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3537 EXPECT_NOT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3539 EXPECT_NOT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3543 * attempt to of_node_get() node "refcount-node". One example of in of_unittest_lifecycle()
3548 * Prevent the stack trace by removing node "refcount-node" from in of_unittest_lifecycle()
3553 * Directly manipulate the child list of node /testcase-data to in of_unittest_lifecycle()
3554 * remove child refcount-node. This is ignoring all proper methods in of_unittest_lifecycle()
3564 prev_sibling = np->child; in of_unittest_lifecycle()
3565 next_sibling = prev_sibling->sibling; in of_unittest_lifecycle()
3566 if (!strcmp(prev_sibling->full_name, "refcount-node")) { in of_unittest_lifecycle()
3567 np->child = next_sibling; in of_unittest_lifecycle()
3568 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3571 if (!strcmp(next_sibling->full_name, "refcount-node")) in of_unittest_lifecycle()
3572 prev_sibling->sibling = next_sibling->sibling; in of_unittest_lifecycle()
3574 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3650 OVERLAY_INFO(overlay_base, -9999, 0),
3667 OVERLAY_INFO(overlay_16, -EBUSY, 0),
3668 OVERLAY_INFO(overlay_17, -EEXIST, 0),
3679 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL, -ENODEV),
3680 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL, -ENODEV),
3681 OVERLAY_INFO(overlay_bad_phandle, -EINVAL, 0),
3682 OVERLAY_INFO(overlay_bad_symbol, -EINVAL, -ENODEV),
3683 OVERLAY_INFO(overlay_bad_unresolved, -EINVAL, 0),
3718 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
3719 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
3731 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
3736 data_size = info->dtbo_end - info->dtbo_begin; in unittest_unflatten_overlay_base()
3742 size = fdt_totalsize(info->dtbo_begin); in unittest_unflatten_overlay_base()
3754 memcpy(new_fdt, info->dtbo_begin, size); in unittest_unflatten_overlay_base()
3766 * /proc/device-tree/ contains the updated structure and values from
3779 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
3780 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3790 size = info->dtbo_end - info->dtbo_begin; in overlay_data_apply()
3794 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id, in overlay_data_apply()
3797 *ovcs_id = info->ovcs_id; in overlay_data_apply()
3804 if (ret != info->expected_result) { in overlay_data_apply()
3806 info->expected_result, ret, overlay_name); in overlay_data_apply()
3812 ret2 = of_overlay_remove(&info->ovcs_id); in overlay_data_apply()
3813 if (ret2 != info->expected_result_remove) { in overlay_data_apply()
3815 info->expected_result_remove, ret2, in overlay_data_apply()
3865 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3866 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3868 *pprev = np->sibling; in of_unittest_overlay_high_level()
3871 pprev = &np->sibling; in of_unittest_overlay_high_level()
3878 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3879 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3882 *pprev = np->sibling; in of_unittest_overlay_high_level()
3885 pprev = &np->sibling; in of_unittest_overlay_high_level()
3892 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3910 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3911 np->parent = of_root; in of_unittest_overlay_high_level()
3915 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3919 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3921 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3933 prop->name); in of_unittest_overlay_high_level()
3938 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
3939 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
3942 prop->name); in of_unittest_overlay_high_level()
3947 prop->name); in of_unittest_overlay_high_level()
3958 /* --- overlay --- */ in of_unittest_overlay_high_level()
3961 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3963 … WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/status"); in of_unittest_overlay_high_level()
3965 …eak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@30/incline-… in of_unittest_overlay_high_level()
3967 …eak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@40/incline-… in of_unittest_overlay_high_level()
3969 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3971 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3973 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3994 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3996 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3998 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
4000 …eak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@40/incline-… in of_unittest_overlay_high_level()
4002 …eak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@30/incline-… in of_unittest_overlay_high_level()
4004 … WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/status"); in of_unittest_overlay_high_level()
4006 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
4010 /* --- overlay_bad_add_dup_node --- */ in of_unittest_overlay_high_level()
4013 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4015 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4017 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
4019 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4025 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4027 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
4029 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4031 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
4033 /* --- overlay_bad_add_dup_prop --- */ in of_unittest_overlay_high_level()
4036 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4038 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4040 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4042 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
4044 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4050 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4052 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
4054 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4056 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4058 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
4060 /* --- overlay_bad_phandle --- */ in of_unittest_overlay_high_level()
4065 /* --- overlay_bad_symbol --- */ in of_unittest_overlay_high_level()
4068 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
4070 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4076 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
4078 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
4080 /* --- overlay_bad_unresolved --- */ in of_unittest_overlay_high_level()
4085 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
4091 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
4119 dn = pdev->dev.of_node; in testdrv_probe()
4121 dev_err(&pdev->dev, "does not find bus endpoint"); in testdrv_probe()
4122 return -EINVAL; in testdrv_probe()
4125 for (info = overlays; info && info->name; info++) { in testdrv_probe()
4126 if (!strcmp(info->name, "overlay_pci_node")) in testdrv_probe()
4129 if (!info || !info->name) { in testdrv_probe()
4130 dev_err(&pdev->dev, "no overlay data for overlay_pci_node"); in testdrv_probe()
4131 return -ENODEV; in testdrv_probe()
4134 size = info->dtbo_end - info->dtbo_begin; in testdrv_probe()
4135 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &ovcs_id, dn); in testdrv_probe()
4140 of_platform_default_populate(dn, NULL, &pdev->dev); in testdrv_probe()
4150 of_platform_depopulate(&pdev->dev); in testdrv_remove()
4169 return -ENODEV; in unittest_pci_probe()
4171 dev = &pdev->dev; in unittest_pci_probe()
4173 dev = dev->parent; in unittest_pci_probe()
4176 return -ENODEV; in unittest_pci_probe()
4180 unittest(res->start == exp_addr, "Incorrect translated address %llx, expected %llx\n", in unittest_pci_probe()
4181 (u64)res->start, exp_addr); in unittest_pci_probe()
4189 { .compatible = "unittest-pci" },
4196 .name = "unittest-pci",
4209 pnp = pdev->dev.of_node; in of_unittest_pci_node_verify()
4212 return -ENODEV; in of_unittest_pci_node_verify()
4215 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0/unittest-pci@100", pnp); in of_unittest_pci_node_verify()
4217 unittest(np, "Failed to get unittest-pci node under PCI node\n"); in of_unittest_pci_node_verify()
4219 rc = -ENODEV; in of_unittest_pci_node_verify()
4226 rc = -ENODEV; in of_unittest_pci_node_verify()
4228 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0", pnp); in of_unittest_pci_node_verify()
4231 child_dev = device_find_any_child(&pdev->dev); in of_unittest_pci_node_verify()
4270 "No test PCI device been found. Please run QEMU with '-device pci-testdev'\n"); in of_unittest_pci_node()
4295 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
4307 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
4346 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()