• Home
  • Raw
  • Download

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

1 // SPDX-License-Identifier: GPL-2.0
6 #define pr_fmt(fmt) "### dt-test ### " fmt
10 #include <linux/dma-direct.h> /* to test phys_to_dma/dma_to_phys */
29 #include <linux/i2c-mux.h>
54 #define OF_KREF_READ(NODE) kref_read(&(NODE)->kobj.kref) argument
56 #define OF_KREF_READ(NODE) 1 argument
60 * Expected message may have a message level other than KERN_INFO.
85 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
87 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
88 "find /testcase-data failed\n"); in of_unittest_find_node_by_name()
93 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
94 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
96 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
98 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
99 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
103 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
105 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
106 "find testcase-alias failed\n"); in of_unittest_find_node_by_name()
111 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
112 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
114 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
116 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
117 "find testcase-alias/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
121 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
122 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
125 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
126 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
129 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
130 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
133 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
138 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
143 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
148 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
152 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
158 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
164 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
169 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
175 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
182 struct property *prop; in of_unittest_dynamic()
184 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
197 /* Add a new property - should pass*/ in of_unittest_dynamic()
198 prop->name = "new-property"; in of_unittest_dynamic()
199 prop->value = "new-property-data"; in of_unittest_dynamic()
200 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
201 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
203 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
205 prop->name = "new-property"; in of_unittest_dynamic()
206 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
207 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
209 "Adding an existing property should have failed\n"); in of_unittest_dynamic()
211 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
212 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
213 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
215 "Updating an existing property should have passed\n"); in of_unittest_dynamic()
217 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
219 prop->name = "modify-property"; in of_unittest_dynamic()
220 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
221 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
223 "Updating a missing property should have passed\n"); in of_unittest_dynamic()
225 /* Remove property - should pass */ in of_unittest_dynamic()
227 "Removing a property should have passed\n"); in of_unittest_dynamic()
229 /* Adding very large property - should pass */ in of_unittest_dynamic()
231 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
232 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
233 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
234 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
235 if (prop->value) in of_unittest_dynamic()
237 "Adding a large property should have passed\n"); in of_unittest_dynamic()
242 struct device_node *child; in of_unittest_check_node_linkage() local
245 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
246 if (child->parent != np) { in of_unittest_check_node_linkage()
247 pr_err("Child node %pOFn links to wrong parent %pOFn\n", in of_unittest_check_node_linkage()
248 child, np); in of_unittest_check_node_linkage()
249 rc = -EINVAL; in of_unittest_check_node_linkage()
253 rc = of_unittest_check_node_linkage(child); in of_unittest_check_node_linkage()
261 of_node_put(child); in of_unittest_check_node_linkage()
277 unittest(child_count > 0, "Device node data structure is corrupted\n"); in of_unittest_check_tree_linkage()
296 /* Baseline; check conversion with a large size limit */ in of_unittest_printf_one()
298 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
307 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
321 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
330 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
337 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
342 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
344 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
345 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
346 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
347 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
349 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
353 struct hlist_node node; member
366 if (!np->phandle) in of_unittest_check_phandles()
369 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
370 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
372 np->phandle, nh->np, np); in of_unittest_check_phandles()
382 nh->np = np; in of_unittest_check_phandles()
383 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
390 hash_for_each_safe(phandle_ht, i, tmp, nh, node) { in of_unittest_check_phandles()
391 hash_del(&nh->node); in of_unittest_check_phandles()
402 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
408 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
415 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
416 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
418 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
432 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
457 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
463 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
470 /* Check for missing list property */ in of_unittest_parse_phandle_with_args()
472 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
473 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
474 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
475 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
476 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
477 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
479 /* Check for missing cells property */ in of_unittest_parse_phandle_with_args()
483 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
485 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
486 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
489 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
491 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
494 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
496 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
497 "#phandle-cells-missing"); in of_unittest_parse_phandle_with_args()
500 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
502 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
508 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
510 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
511 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
514 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
516 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
519 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
521 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
522 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
525 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
527 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
533 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
535 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
536 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
539 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
541 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
544 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
546 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
547 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
550 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
552 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
562 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
568 p[0] = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
569 p[1] = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
570 p[2] = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
571 p[3] = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); in of_unittest_parse_phandle_with_args_map()
572 p[4] = of_find_node_by_path("/testcase-data/phandle-tests/provider4"); in of_unittest_parse_phandle_with_args_map()
573 p[5] = of_find_node_by_path("/testcase-data/phandle-tests/provider5"); in of_unittest_parse_phandle_with_args_map()
582 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
589 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
592 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
609 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
643 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
649 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
650 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
656 /* Check for missing list property */ in of_unittest_parse_phandle_with_args_map()
658 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
660 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
662 /* Check for missing cells,map,mask property */ in of_unittest_parse_phandle_with_args_map()
666 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
668 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
669 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
671 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
673 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
679 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); in of_unittest_parse_phandle_with_args_map()
681 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
684 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); in of_unittest_parse_phandle_with_args_map()
686 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
692 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); in of_unittest_parse_phandle_with_args_map()
694 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
697 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); in of_unittest_parse_phandle_with_args_map()
699 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
715 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
721 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
723 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
725 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
727 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
728 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
729 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
730 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
731 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
732 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
733 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
734 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
737 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
739 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
741 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
742 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
743 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
744 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
747 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
750 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
751 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
752 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
754 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
756 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
759 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
760 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
762 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
763 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
764 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
767 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
768 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
772 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
774 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
776 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
777 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
778 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
779 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
780 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
781 /* -- parsing the correctly formed strings should still work: */ in of_unittest_property_string()
783 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
786 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
790 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
791 (p1)->value && (p2)->value && \
792 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
793 !strcmp((p1)->name, (p2)->name))
797 struct property p1 = { .name = "p1", .length = 0, .value = "" }; in of_unittest_property_copy()
798 struct property p2 = { .name = "p2", .length = 5, .value = "abcd" }; in of_unittest_property_copy()
799 struct property *new; in of_unittest_property_copy()
802 unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n"); in of_unittest_property_copy()
803 kfree(new->value); in of_unittest_property_copy()
804 kfree(new->name); in of_unittest_property_copy()
808 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
809 kfree(new->value); in of_unittest_property_copy()
810 kfree(new->name); in of_unittest_property_copy()
819 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
820 struct property *ppname_n1, pname_n1 = { .name = "name", .length = 3, .value = "n1" }; in of_unittest_changeset()
821 struct property *ppname_n2, pname_n2 = { .name = "name", .length = 3, .value = "n2" }; in of_unittest_changeset()
822 struct property *ppname_n21, pname_n21 = { .name = "name", .length = 3, .value = "n21" }; in of_unittest_changeset()
823 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
824 struct property *ppremove; in of_unittest_changeset()
840 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
841 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
860 n1->parent = parent; in of_unittest_changeset()
861 n2->parent = parent; in of_unittest_changeset()
862 n21->parent = n2; in of_unittest_changeset()
864 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
875 unittest(!of_changeset_detach_node(&chgset, nremove), "fail remove node\n"); in of_unittest_changeset()
880 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
885 unittest(!of_changeset_add_prop_string(&chgset, n22, "prop-str", "abcd"), in of_unittest_changeset()
886 "fail add prop prop-str"); in of_unittest_changeset()
887 unittest(!of_changeset_add_prop_string_array(&chgset, n22, "prop-str-array", in of_unittest_changeset()
890 "fail add prop prop-str-array"); in of_unittest_changeset()
891 unittest(!of_changeset_add_prop_u32_array(&chgset, n22, "prop-u32-array", in of_unittest_changeset()
893 "fail add prop prop-u32-array"); in of_unittest_changeset()
899 /* Make sure node names are constructed correctly */ in of_unittest_changeset()
900 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
903 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n22")), in of_unittest_changeset()
909 unittest(!of_find_node_by_path("/testcase-data/changeset/n2/n21"), in of_unittest_changeset()
912 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
915 ret = of_property_read_string(parent, "prop-update", &propstr); in of_unittest_changeset()
918 unittest(strcmp(propstr, "hello") == 0, "original value not in updated property after revert"); in of_unittest_changeset()
937 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
965 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
979 dev_bogus->dma_range_map = map; in of_unittest_dma_ranges_one()
984 "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
987 "of_dma_get_range: wrong DMA addr %pad (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
999 of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", in of_unittest_parse_dma_ranges()
1002 of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", in of_unittest_parse_dma_ranges()
1004 of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", in of_unittest_parse_dma_ranges()
1018 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
1025 pr_err("missing dma-ranges property\n"); in of_unittest_pci_dma_ranges()
1030 * Get the dma-ranges from the device tree in of_unittest_pci_dma_ranges()
1035 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1038 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1041 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1045 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1048 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1051 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1068 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1075 pr_err("missing ranges property\n"); in of_unittest_bus_ranges()
1080 unittest(!ret, "of_range_to_resource returned error (%d) node %pOF\n", in of_unittest_bus_ranges()
1083 "of_range_to_resource wrong resource type on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1086 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1089 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1094 "of_range_count wrong size on node %pOF count=%d\n", in of_unittest_bus_ranges()
1102 "for_each_of_range wrong flags on node %pOF flags=%x (expected %x)\n", in of_unittest_bus_ranges()
1106 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1109 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1112 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1116 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1119 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1122 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1138 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); in of_unittest_bus_3cell_ranges()
1145 pr_err("missing ranges property\n"); in of_unittest_bus_3cell_ranges()
1155 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1158 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1161 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1164 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1168 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1171 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1174 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1177 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1193 np = of_find_node_by_path("/testcase-data/address-tests/bus@80000000/device@1000"); in of_unittest_reg()
1207 np = of_find_node_by_path("/testcase-data/platform-tests-2/node/test-device@100"); in of_unittest_reg()
1214 unittest(ret == -EINVAL, "of_address_to_resource(%pOF) expected error on untranslatable address\n", in of_unittest_reg()
1230 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1246 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1251 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1263 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1292 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1307 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1319 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1359 * Tests child node that is missing property in of_unittest_parse_interrupts_extended()
1360 * #address-cells. See the comments in in of_unittest_parse_interrupts_extended()
1361 * drivers/of/unittest-data/tests-interrupts.dtsi in of_unittest_parse_interrupts_extended()
1362 * nodes intmap1 and interrupts-extended0 in of_unittest_parse_interrupts_extended()
1372 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
1379 { .data = "A", .name = "name0", }, /* Name alone is lowest priority */
1399 { .path = "/testcase-data/match-node/name0", .data = "A", },
1400 { .path = "/testcase-data/match-node/name1", .data = "B", },
1401 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1402 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1403 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1404 { .path = "/testcase-data/match-node/name3", .data = "E", },
1405 { .path = "/testcase-data/match-node/name4", .data = "G", },
1406 { .path = "/testcase-data/match-node/name5", .data = "H", },
1407 { .path = "/testcase-data/match-node/name6", .data = "G", },
1408 { .path = "/testcase-data/match-node/name7", .data = "I", },
1409 { .path = "/testcase-data/match-node/name8", .data = "J", },
1410 { .path = "/testcase-data/match-node/name9", .data = "K", },
1422 unittest(0, "missing testcase node %s\n", in of_unittest_match_node()
1434 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1437 (const char *)match->data); in of_unittest_match_node()
1446 .name = "unittest-bus",
1451 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1454 { .compatible = "test-device", }, in of_unittest_platform_populate()
1458 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1461 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1462 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1468 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1469 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1471 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1472 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1477 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1482 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1484 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1485 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1488 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1500 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1503 * Add a dummy resource to the test bus node after it is in of_unittest_platform_populate()
1504 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1511 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1512 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1513 for_each_child_of_node(child, grandchild) { in of_unittest_platform_populate()
1516 "Could not create device for node '%pOFn'\n", in of_unittest_platform_populate()
1522 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1523 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1524 for_each_child_of_node(child, grandchild) in of_unittest_platform_populate()
1535 * update_node_properties - adds the properties
1536 * of np into dup node (present in live tree) and
1539 * @np: node whose properties are being added to the live tree
1540 * @dup: node present in live tree to be updated
1545 struct property *prop; in update_node_properties()
1546 struct property *save_next; in update_node_properties()
1547 struct device_node *child; in update_node_properties() local
1550 for_each_child_of_node(np, child) in update_node_properties()
1551 child->parent = dup; in update_node_properties()
1554 * "unittest internal error: unable to add testdata property" in update_node_properties()
1556 * If this message reports a property in node '/__symbols__' then in update_node_properties()
1557 * the respective unittest overlay contains a label that has the in update_node_properties()
1558 * same name as a label in the live devicetree. The label will in update_node_properties()
1560 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1563 * used in a real devicetree. in update_node_properties()
1568 * sets prop->next to NULL in update_node_properties()
1570 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1571 save_next = prop->next; in update_node_properties()
1574 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1576 pr_err("unittest internal error: unable to add testdata property %pOF/%s", in update_node_properties()
1577 np, prop->name); in update_node_properties()
1583 * attach_node_and_children - attaches nodes
1585 * CAUTION: misleading function name - if node @np already exists in
1588 * nodes do not have child nodes.
1590 * @np: Node to attach to live tree
1594 struct device_node *next, *dup, *child; in attach_node_and_children() local
1615 child = np->child; in attach_node_and_children()
1616 np->child = NULL; in attach_node_and_children()
1620 np->sibling = np->parent->child; in attach_node_and_children()
1621 np->parent->child = np; in attach_node_and_children()
1628 while (child) { in attach_node_and_children()
1629 next = child->sibling; in attach_node_and_children()
1630 attach_node_and_children(child); in attach_node_and_children()
1631 child = next; in attach_node_and_children()
1636 * unittest_data_add - Reads, copies data from
1650 const int size = __dtbo_testcases_end - __dtbo_testcases_begin; in unittest_data_add()
1656 return -ENODATA; in unittest_data_add()
1662 return -ENOMEM; in unittest_data_add()
1671 return -ENODATA; in unittest_data_add()
1676 return -ENODATA; in unittest_data_add()
1688 return -EINVAL; in unittest_data_add()
1702 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1704 /* attach the sub-tree to live tree */ in unittest_data_add()
1705 np = unittest_data_node->child; in unittest_data_add()
1707 struct device_node *next = np->sibling; in unittest_data_add()
1709 np->parent = of_root; in unittest_data_add()
1716 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1728 struct device *dev = &pdev->dev; in unittest_probe()
1729 struct device_node *np = dev->of_node; in unittest_probe()
1733 return -EINVAL; in unittest_probe()
1737 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
1739 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1746 struct device *dev = &pdev->dev; in unittest_remove()
1747 struct device_node *np = dev->of_node; in unittest_remove()
1749 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
1782 /* find out if a platform device exists at that path */
1806 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
1820 return -ENOMEM; in unittest_gpio_probe()
1824 devptr->chip.fwnode = dev_fwnode(&pdev->dev); in unittest_gpio_probe()
1825 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
1826 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
1827 devptr->chip.ngpio = 5; in unittest_gpio_probe()
1828 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
1830 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
1833 "gpiochip_add_data() for node @%pfw failed, ret = %d\n", devptr->chip.fwnode, ret); in unittest_gpio_probe()
1843 struct device *dev = &pdev->dev; in unittest_gpio_remove()
1845 dev_dbg(dev, "%s for node @%pfw\n", __func__, devptr->chip.fwnode); in unittest_gpio_remove()
1847 if (devptr->chip.base != -1) in unittest_gpio_remove()
1848 gpiochip_remove(&devptr->chip); in unittest_gpio_remove()
1854 { .compatible = "unittest-gpio", },
1862 .name = "unittest-gpio",
1875 * Similar to installing a driver as a module, the in of_unittest_overlay_gpio()
1883 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
1884 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
1885 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
1886 * - register driver in of_unittest_overlay_gpio()
1889 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
1890 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
1891 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
1898 * overlay_gpio_01 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1899 * overlay_gpio_02a contains gpio node in of_unittest_overlay_gpio()
1900 * overlay_gpio_02b contains child gpio hog node in of_unittest_overlay_gpio()
1921 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1926 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
1929 * overlay_gpio_03 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1931 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
1934 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
1940 /* overlay_gpio_03 contains gpio node and child gpio hog node */ in of_unittest_overlay_gpio()
1950 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1953 * overlay_gpio_04a contains gpio node in of_unittest_overlay_gpio()
1955 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
1958 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
1964 /* overlay_gpio_04a contains gpio node */ in of_unittest_overlay_gpio()
1973 * overlay_gpio_04b contains child gpio hog node in of_unittest_overlay_gpio()
1975 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
1978 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
1981 /* overlay_gpio_04b contains child gpio hog node */ in of_unittest_overlay_gpio()
1988 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
2018 /* find out if a i2c client device exists at that path */
2025 put_device(&client->dev); in of_path_i2c_client_exists()
2059 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
2062 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
2068 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
2069 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
2092 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
2094 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
2099 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
2122 track_ovcs_id_cnt--; in of_unittest_untrack_overlay()
2135 ovcs_id = track_ovcs_id[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2136 overlay_nr = track_ovcs_id_overlay_nr[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2139 if (ret == -ENODEV) { in of_unittest_remove_tracked_overlays()
2162 return -EFAULT; in of_unittest_apply_overlay()
2181 return -EINVAL; in __of_unittest_apply_overlay_check()
2198 return -EINVAL; in __of_unittest_apply_overlay_check()
2246 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2258 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2264 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2278 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2284 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2299 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2305 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2318 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2324 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2332 /* test activation of a full device node */
2348 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2354 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2388 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2402 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2405 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2419 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2435 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2475 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2484 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2495 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2501 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2515 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2526 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2530 * Should never get here. If we do, expect a lot of in of_unittest_overlay_8()
2541 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2556 /* test insertion of a bus with parent devices */
2569 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2577 unittest(ret, "overlay test %d failed; no child device\n", 10); in of_unittest_overlay_10()
2580 /* test insertion of a bus with parent devices (and revert) */
2621 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2622 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2629 return -EINVAL; in unittest_i2c_bus_probe()
2633 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
2637 return -ENOMEM; in unittest_i2c_bus_probe()
2640 std->pdev = pdev; in unittest_i2c_bus_probe()
2643 adap = &std->adap; in unittest_i2c_bus_probe()
2645 adap->nr = -1; in unittest_i2c_bus_probe()
2646 strscpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2647 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2648 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2649 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2650 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2651 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2652 adap->retries = 3; in unittest_i2c_bus_probe()
2665 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
2666 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
2669 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
2670 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
2674 { .compatible = "unittest-i2c-bus", },
2682 .name = "unittest-i2c-bus",
2689 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
2690 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
2693 dev_err(dev, "No OF node\n"); in unittest_i2c_dev_probe()
2694 return -EINVAL; in unittest_i2c_dev_probe()
2697 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
2704 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
2705 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
2707 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
2711 { .name = "unittest-i2c-dev" },
2717 .name = "unittest-i2c-dev",
2734 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
2735 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
2736 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
2740 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
2743 dev_err(dev, "No OF node\n"); in unittest_i2c_mux_probe()
2744 return -EINVAL; in unittest_i2c_mux_probe()
2747 max_reg = (u32)-1; in unittest_i2c_mux_probe()
2748 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
2749 if (of_property_read_u32(child, "reg", &reg)) in unittest_i2c_mux_probe()
2751 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
2754 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
2757 return -EINVAL; in unittest_i2c_mux_probe()
2763 return -ENOMEM; in unittest_i2c_mux_probe()
2768 return -ENODEV; in unittest_i2c_mux_probe()
2779 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
2780 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
2783 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
2788 { .name = "unittest-i2c-mux" },
2794 .name = "unittest-i2c-mux",
2821 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2826 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2851 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2856 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2870 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2876 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2895 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2900 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2926 * ret = -EBUSY which is -16. in of_notify()
2935 of_node_get(nd->overlay); in of_notify()
2940 found = of_find_node_by_name(nd->overlay, "test-unittest16"); in of_notify()
2943 ret = -EBUSY; in of_notify()
2948 found = of_find_node_by_name(nd->overlay, "test-unittest17"); in of_notify()
2951 ret = -EEXIST; in of_notify()
2956 found = of_find_node_by_name(nd->overlay, "test-unittest18"); in of_notify()
2959 ret = -EXDEV; in of_notify()
2964 found = of_find_node_by_name(nd->overlay, "test-unittest19"); in of_notify()
2967 ret = -ENODEV; in of_notify()
2972 of_node_put(nd->overlay); in of_notify()
2973 ret = -EINVAL; in of_notify()
3004 * Applying overlays 16 - 19 will each trigger an error for a in of_unittest_overlay_notify()
3010 /* --- overlay 16 --- */ in of_unittest_overlay_notify()
3012 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3017 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
3021 /* --- overlay 17 --- */ in of_unittest_overlay_notify()
3023 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3028 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3032 /* --- overlay 18 --- */ in of_unittest_overlay_notify()
3040 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3043 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3044 if (ret == -EXDEV) { in of_unittest_overlay_notify()
3058 /* --- overlay 19 --- */ in of_unittest_overlay_notify()
3066 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3068 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3069 if (ret == -ENODEV) in of_unittest_overlay_notify()
3080 /* --- overlay 20 --- */ in of_unittest_overlay_notify()
3181 const char *refcount_path = "/testcase-data/refcount-node"; in of_unittest_lifecycle()
3182 const char *refcount_parent_path = "/testcase-data"; in of_unittest_lifecycle()
3185 * Node lifecycle tests, non-dynamic node: in of_unittest_lifecycle()
3187 * - Decrementing refcount to zero via of_node_put() should cause the in of_unittest_lifecycle()
3188 * attempt to free the node memory by of_node_release() to fail in of_unittest_lifecycle()
3189 * because the node is not a dynamic node. in of_unittest_lifecycle()
3191 * - Decrementing refcount past zero should result in additional in of_unittest_lifecycle()
3207 refcount = kref_read(&np->kobj.kref); in of_unittest_lifecycle()
3214 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3217 * refcount is now one, decrementing to zero will result in a call to in of_unittest_lifecycle()
3218 * of_node_release() to free the node's memory, which should result in of_unittest_lifecycle()
3221 unittest(1, "/testcase-data/refcount-node is one"); in of_unittest_lifecycle()
3224 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3235 EXPECT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3237 EXPECT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3238 EXPECT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3241 unittest(1, "/testcase-data/refcount-node is zero"); in of_unittest_lifecycle()
3244 EXPECT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3245 EXPECT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3247 EXPECT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3251 * A. no, the WARNING is from WARN_ONCE() in of_unittest_lifecycle()
3253 EXPECT_NOT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3255 EXPECT_NOT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3256 EXPECT_NOT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3258 unittest(1, "/testcase-data/refcount-node is zero, second time"); in of_unittest_lifecycle()
3261 EXPECT_NOT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3262 EXPECT_NOT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3264 EXPECT_NOT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3268 * attempt to of_node_get() node "refcount-node". One example of in of_unittest_lifecycle()
3271 * of_node_get() of the children of a node. in of_unittest_lifecycle()
3273 * Prevent the stack trace by removing node "refcount-node" from in of_unittest_lifecycle()
3274 * its parent's child list. in of_unittest_lifecycle()
3278 * Directly manipulate the child list of node /testcase-data to in of_unittest_lifecycle()
3279 * remove child refcount-node. This is ignoring all proper methods in of_unittest_lifecycle()
3280 * of removing a child and will leak a small amount of memory. in of_unittest_lifecycle()
3285 unittest(np, "ERROR: devicetree live tree left in a 'bad state' if test fail\n"); in of_unittest_lifecycle()
3289 prev_sibling = np->child; in of_unittest_lifecycle()
3290 next_sibling = prev_sibling->sibling; in of_unittest_lifecycle()
3291 if (!strcmp(prev_sibling->full_name, "refcount-node")) { in of_unittest_lifecycle()
3292 np->child = next_sibling; in of_unittest_lifecycle()
3293 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3296 if (!strcmp(next_sibling->full_name, "refcount-node")) in of_unittest_lifecycle()
3297 prev_sibling->sibling = next_sibling->sibling; in of_unittest_lifecycle()
3299 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3375 OVERLAY_INFO(overlay_base, -9999, 0),
3392 OVERLAY_INFO(overlay_16, -EBUSY, 0),
3393 OVERLAY_INFO(overlay_17, -EEXIST, 0),
3404 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL, -ENODEV),
3405 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL, -ENODEV),
3406 OVERLAY_INFO(overlay_bad_phandle, -EINVAL, 0),
3407 OVERLAY_INFO(overlay_bad_symbol, -EINVAL, -ENODEV),
3408 OVERLAY_INFO(overlay_bad_unresolved, -EINVAL, 0),
3449 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
3450 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
3462 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
3467 data_size = info->dtbo_end - info->dtbo_begin; in unittest_unflatten_overlay_base()
3473 size = fdt_totalsize(info->dtbo_begin); in unittest_unflatten_overlay_base()
3485 memcpy(new_fdt, info->dtbo_begin, size); in unittest_unflatten_overlay_base()
3493 * overlay in the normal fashion. This is a test of the whole
3496 * A secondary purpose is to be able to verify that the contents of
3497 * /proc/device-tree/ contains the updated structure and values from
3510 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
3511 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3521 size = info->dtbo_end - info->dtbo_begin; in overlay_data_apply()
3525 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id, in overlay_data_apply()
3528 *ovcs_id = info->ovcs_id; in overlay_data_apply()
3535 if (ret != info->expected_result) { in overlay_data_apply()
3537 info->expected_result, ret, overlay_name); in overlay_data_apply()
3543 ret2 = of_overlay_remove(&info->ovcs_id); in overlay_data_apply()
3544 if (ret2 != info->expected_result_remove) { in overlay_data_apply()
3546 info->expected_result_remove, ret2, in overlay_data_apply()
3557 * in the normal fashion. This is a test of the whole picture,
3570 struct property *prop; in of_unittest_overlay_high_level()
3588 * do not allow overlay_base to duplicate any node already in in of_unittest_overlay_high_level()
3593 * remove overlay_base_root node "__local_fixups", after in of_unittest_overlay_high_level()
3596 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3597 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3599 *pprev = np->sibling; in of_unittest_overlay_high_level()
3602 pprev = &np->sibling; in of_unittest_overlay_high_level()
3605 /* remove overlay_base_root node "__symbols__" if in live tree */ in of_unittest_overlay_high_level()
3608 /* will have to graft properties from node into live tree */ in of_unittest_overlay_high_level()
3609 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3610 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3613 *pprev = np->sibling; in of_unittest_overlay_high_level()
3616 pprev = &np->sibling; in of_unittest_overlay_high_level()
3623 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3624 unittest(0, "illegal node name in overlay_base %pOFn", in of_unittest_overlay_high_level()
3637 * root node of *overlay_base_root will not be freed, it is lost in of_unittest_overlay_high_level()
3641 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3642 np->parent = of_root; in of_unittest_overlay_high_level()
3646 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3650 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3652 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3658 struct property *new_prop; in of_unittest_overlay_high_level()
3663 unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__", in of_unittest_overlay_high_level()
3664 prop->name); in of_unittest_overlay_high_level()
3668 kfree(new_prop->name); in of_unittest_overlay_high_level()
3669 kfree(new_prop->value); in of_unittest_overlay_high_level()
3671 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
3672 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
3674 unittest(0, "duplicate property '%s' in overlay_base node __symbols__", in of_unittest_overlay_high_level()
3675 prop->name); in of_unittest_overlay_high_level()
3679 unittest(0, "unable to add property '%s' in overlay_base node __symbols__ to sysfs", in of_unittest_overlay_high_level()
3680 prop->name); in of_unittest_overlay_high_level()
3691 /* --- overlay --- */ in of_unittest_overlay_high_level()
3694 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3696 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3698 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3700 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3702 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3704 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3706 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3708 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3710 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3712 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3714 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3719 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3721 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3723 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3725 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3727 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3729 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3731 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3733 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3735 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3737 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3739 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3743 /* --- overlay_bad_add_dup_node --- */ in of_unittest_overlay_high_level()
3746 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3748 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3750 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
3752 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3758 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3760 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
3762 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3764 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3766 /* --- overlay_bad_add_dup_prop --- */ in of_unittest_overlay_high_level()
3769 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3771 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3773 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3775 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
3777 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3783 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3785 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
3787 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3789 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3791 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3793 /* --- overlay_bad_phandle --- */ in of_unittest_overlay_high_level()
3798 /* --- overlay_bad_symbol --- */ in of_unittest_overlay_high_level()
3801 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
3803 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3809 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3811 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
3813 /* --- overlay_bad_unresolved --- */ in of_unittest_overlay_high_level()
3816 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
3818 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
3824 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
3826 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
3838 * PCI device tree node test driver
3852 dn = pdev->dev.of_node; in testdrv_probe()
3854 dev_err(&pdev->dev, "does not find bus endpoint"); in testdrv_probe()
3855 return -EINVAL; in testdrv_probe()
3858 for (info = overlays; info && info->name; info++) { in testdrv_probe()
3859 if (!strcmp(info->name, "overlay_pci_node")) in testdrv_probe()
3862 if (!info || !info->name) { in testdrv_probe()
3863 dev_err(&pdev->dev, "no overlay data for overlay_pci_node"); in testdrv_probe()
3864 return -ENODEV; in testdrv_probe()
3867 size = info->dtbo_end - info->dtbo_begin; in testdrv_probe()
3868 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &ovcs_id, dn); in testdrv_probe()
3873 of_platform_default_populate(dn, NULL, &pdev->dev); in testdrv_probe()
3883 of_platform_depopulate(&pdev->dev); in testdrv_remove()
3902 return -ENODEV; in unittest_pci_probe()
3904 dev = &pdev->dev; in unittest_pci_probe()
3906 dev = dev->parent; in unittest_pci_probe()
3909 return -ENODEV; in unittest_pci_probe()
3913 unittest(res->start == exp_addr, "Incorrect translated address %llx, expected %llx\n", in unittest_pci_probe()
3914 (u64)res->start, exp_addr); in unittest_pci_probe()
3922 { .compatible = "unittest-pci" },
3929 .name = "unittest-pci",
3942 pnp = pdev->dev.of_node; in of_unittest_pci_node_verify()
3943 unittest(pnp, "Failed creating PCI dt node\n"); in of_unittest_pci_node_verify()
3945 return -ENODEV; in of_unittest_pci_node_verify()
3948 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0/unittest-pci@100", pnp); in of_unittest_pci_node_verify()
3950 unittest(np, "Failed to get unittest-pci node under PCI node\n"); in of_unittest_pci_node_verify()
3952 rc = -ENODEV; in of_unittest_pci_node_verify()
3957 unittest(reg, "Failed to get reg property\n"); in of_unittest_pci_node_verify()
3959 rc = -ENODEV; in of_unittest_pci_node_verify()
3961 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0", pnp); in of_unittest_pci_node_verify()
3963 unittest(!np, "Child device tree node is not removed\n"); in of_unittest_pci_node_verify()
3964 child_dev = device_find_any_child(&pdev->dev); in of_unittest_pci_node_verify()
3965 unittest(!child_dev, "Child device is not removed\n"); in of_unittest_pci_node_verify()
4003 "No test PCI device been found. Please run QEMU with '-device pci-testdev'\n"); in of_unittest_pci_node()
4005 "Child device number %d is not expected %d", of_unittest_pci_child_num, in of_unittest_pci_node()
4028 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
4040 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
4076 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()