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 * Expected message may have a message level other than KERN_INFO.
79 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
81 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
82 "find /testcase-data failed\n"); in of_unittest_find_node_by_name()
87 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
88 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
90 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
92 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
93 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
97 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
99 unittest(np && name && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
100 "find testcase-alias failed\n"); in of_unittest_find_node_by_name()
105 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
106 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
108 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
110 unittest(np && name && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
111 "find testcase-alias/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
115 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
116 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
119 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
120 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
123 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
124 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
127 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
132 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
137 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
142 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
146 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
152 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
158 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
163 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
169 unittest(np && !options, "option clearing root node test failed\n"); in of_unittest_find_node_by_name()
176 struct property *prop; in of_unittest_dynamic()
178 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
191 /* Add a new property - should pass*/ in of_unittest_dynamic()
192 prop->name = "new-property"; in of_unittest_dynamic()
193 prop->value = "new-property-data"; in of_unittest_dynamic()
194 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
195 unittest(of_add_property(np, prop) == 0, "Adding a new property failed\n"); in of_unittest_dynamic()
197 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
199 prop->name = "new-property"; in of_unittest_dynamic()
200 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
201 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
203 "Adding an existing property should have failed\n"); in of_unittest_dynamic()
205 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
206 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
207 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
209 "Updating an existing property should have passed\n"); in of_unittest_dynamic()
211 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
213 prop->name = "modify-property"; in of_unittest_dynamic()
214 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
215 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
217 "Updating a missing property should have passed\n"); in of_unittest_dynamic()
219 /* Remove property - should pass */ in of_unittest_dynamic()
221 "Removing a property should have passed\n"); in of_unittest_dynamic()
223 /* Adding very large property - should pass */ in of_unittest_dynamic()
225 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
226 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
227 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
228 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
229 if (prop->value) in of_unittest_dynamic()
231 "Adding a large property should have passed\n"); in of_unittest_dynamic()
236 struct device_node *child; in of_unittest_check_node_linkage() local
239 for_each_child_of_node(np, child) { in of_unittest_check_node_linkage()
240 if (child->parent != np) { in of_unittest_check_node_linkage()
241 pr_err("Child node %pOFn links to wrong parent %pOFn\n", in of_unittest_check_node_linkage()
242 child, np); in of_unittest_check_node_linkage()
243 rc = -EINVAL; in of_unittest_check_node_linkage()
247 rc = of_unittest_check_node_linkage(child); in of_unittest_check_node_linkage()
255 of_node_put(child); in of_unittest_check_node_linkage()
271 unittest(child_count > 0, "Device node data structure is corrupted\n"); in of_unittest_check_tree_linkage()
290 /* Baseline; check conversion with a large size limit */ in of_unittest_printf_one()
292 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
301 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
315 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
324 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
331 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
336 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
338 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
339 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
340 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
341 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
343 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
347 struct hlist_node node; member
360 if (!np->phandle) in of_unittest_check_phandles()
363 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
364 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
366 np->phandle, nh->np, np); in of_unittest_check_phandles()
376 nh->np = np; in of_unittest_check_phandles()
377 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
384 hash_for_each_safe(phandle_ht, i, tmp, nh, node) { in of_unittest_check_phandles()
385 hash_del(&nh->node); in of_unittest_check_phandles()
396 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
402 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
409 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
410 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
412 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
426 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
451 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
457 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
461 /* Check for missing list property */ in of_unittest_parse_phandle_with_args()
463 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
464 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
465 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
466 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
467 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
468 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
470 /* Check for missing cells property */ in of_unittest_parse_phandle_with_args()
474 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
476 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
477 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
480 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
482 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
485 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
487 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
488 "#phandle-cells-missing"); in of_unittest_parse_phandle_with_args()
491 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
493 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
499 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
501 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
502 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
505 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
507 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
510 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
512 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
513 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
516 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
518 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
524 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
526 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
527 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
530 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
532 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
535 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
537 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
538 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
541 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1"); in of_unittest_parse_phandle_with_args()
543 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
552 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
558 p0 = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
564 p1 = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
570 p2 = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
576 p3 = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); 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()
635 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
641 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
642 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
645 /* Check for missing list property */ in of_unittest_parse_phandle_with_args_map()
647 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
649 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
651 /* Check for missing cells,map,mask property */ in of_unittest_parse_phandle_with_args_map()
655 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
657 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
658 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
660 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
662 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
668 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); in of_unittest_parse_phandle_with_args_map()
670 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
673 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle 12345678"); in of_unittest_parse_phandle_with_args_map()
675 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
681 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); in of_unittest_parse_phandle_with_args_map()
683 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
686 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1"); in of_unittest_parse_phandle_with_args_map()
688 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
697 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
703 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
705 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
707 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
709 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
710 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
711 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
712 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
713 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
714 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
715 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
716 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
719 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
721 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
723 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
724 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
725 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
726 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
729 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
732 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
733 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
734 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
736 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
738 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
741 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
742 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
744 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
745 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
746 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
749 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
750 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
754 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
756 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
758 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
759 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
760 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
761 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
762 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
763 /* -- parsing the correctly formed strings should still work: */ in of_unittest_property_string()
765 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
768 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
772 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
773 (p1)->value && (p2)->value && \
774 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
775 !strcmp((p1)->name, (p2)->name))
779 struct property p1 = { .name = "p1", .length = 0, .value = "" }; in of_unittest_property_copy()
780 struct property p2 = { .name = "p2", .length = 5, .value = "abcd" }; in of_unittest_property_copy()
781 struct property *new; in of_unittest_property_copy()
784 unittest(new && propcmp(&p1, new), "empty property didn't copy correctly\n"); in of_unittest_property_copy()
785 kfree(new->value); in of_unittest_property_copy()
786 kfree(new->name); in of_unittest_property_copy()
790 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
791 kfree(new->value); in of_unittest_property_copy()
792 kfree(new->name); in of_unittest_property_copy()
801 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
802 struct property *ppname_n1, pname_n1 = { .name = "name", .length = 3, .value = "n1" }; in of_unittest_changeset()
803 struct property *ppname_n2, pname_n2 = { .name = "name", .length = 3, .value = "n2" }; in of_unittest_changeset()
804 struct property *ppname_n21, pname_n21 = { .name = "name", .length = 3, .value = "n21" }; in of_unittest_changeset()
805 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
806 struct property *ppremove; in of_unittest_changeset()
822 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
823 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
842 n1->parent = parent; in of_unittest_changeset()
843 n2->parent = parent; in of_unittest_changeset()
844 n21->parent = n2; in of_unittest_changeset()
846 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
857 unittest(!of_changeset_detach_node(&chgset, nremove), "fail remove node\n"); in of_unittest_changeset()
862 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
867 unittest(!of_changeset_add_prop_string(&chgset, n22, "prop-str", "abcd"), in of_unittest_changeset()
868 "fail add prop prop-str"); in of_unittest_changeset()
869 unittest(!of_changeset_add_prop_string_array(&chgset, n22, "prop-str-array", in of_unittest_changeset()
872 "fail add prop prop-str-array"); in of_unittest_changeset()
873 unittest(!of_changeset_add_prop_u32_array(&chgset, n22, "prop-u32-array", in of_unittest_changeset()
875 "fail add prop prop-u32-array"); in of_unittest_changeset()
881 /* Make sure node names are constructed correctly */ in of_unittest_changeset()
882 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
885 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n22")), in of_unittest_changeset()
891 unittest(!of_find_node_by_path("/testcase-data/changeset/n2/n21"), in of_unittest_changeset()
894 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
897 ret = of_property_read_string(parent, "prop-update", &propstr); in of_unittest_changeset()
900 unittest(strcmp(propstr, "hello") == 0, "original value not in updated property after revert"); in of_unittest_changeset()
919 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
947 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
961 dev_bogus->dma_range_map = map; in of_unittest_dma_ranges_one()
966 "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
969 "of_dma_get_range: wrong DMA addr %pad (expecting %llx) on node %pOF\n", in of_unittest_dma_ranges_one()
981 of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", in of_unittest_parse_dma_ranges()
984 of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", in of_unittest_parse_dma_ranges()
986 of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", in of_unittest_parse_dma_ranges()
1000 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
1007 pr_err("missing dma-ranges property\n"); in of_unittest_pci_dma_ranges()
1012 * Get the dma-ranges from the device tree in of_unittest_pci_dma_ranges()
1017 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1020 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1023 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1027 "for_each_of_pci_range wrong size on node %pOF size=%llx\n", in of_unittest_pci_dma_ranges()
1030 "for_each_of_pci_range wrong CPU addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1033 "for_each_of_pci_range wrong DMA addr (%llx) on node %pOF", in of_unittest_pci_dma_ranges()
1050 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_bus_ranges()
1057 pr_err("missing ranges property\n"); in of_unittest_bus_ranges()
1062 unittest(!ret, "of_range_to_resource returned error (%d) node %pOF\n", in of_unittest_bus_ranges()
1065 "of_range_to_resource wrong resource type on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1068 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1071 "of_range_to_resource wrong resource start address on node %pOF res=%pR\n", in of_unittest_bus_ranges()
1076 "of_range_count wrong size on node %pOF count=%d\n", in of_unittest_bus_ranges()
1084 "for_each_of_range wrong flags on node %pOF flags=%x (expected %x)\n", in of_unittest_bus_ranges()
1088 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1091 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1094 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1098 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_ranges()
1101 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1104 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_ranges()
1120 np = of_find_node_by_path("/testcase-data/address-tests/bus@a0000000"); in of_unittest_bus_3cell_ranges()
1127 pr_err("missing ranges property\n"); in of_unittest_bus_3cell_ranges()
1137 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1140 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1143 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1146 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1150 "for_each_of_range wrong flags on node %pOF flags=%x\n", in of_unittest_bus_3cell_ranges()
1153 "for_each_of_range wrong size on node %pOF size=%llx\n", in of_unittest_bus_3cell_ranges()
1156 "for_each_of_range wrong CPU addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1159 "for_each_of_range wrong bus addr (%llx) on node %pOF", in of_unittest_bus_3cell_ranges()
1174 np = of_find_node_by_path("/testcase-data/address-tests/bus@80000000/device@1000"); in of_unittest_reg()
1198 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1214 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1219 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1231 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1260 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1275 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1287 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1327 * Tests child node that is missing property in of_unittest_parse_interrupts_extended()
1328 * #address-cells. See the comments in in of_unittest_parse_interrupts_extended()
1329 * drivers/of/unittest-data/tests-interrupts.dtsi in of_unittest_parse_interrupts_extended()
1330 * nodes intmap1 and interrupts-extended0 in of_unittest_parse_interrupts_extended()
1340 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
1347 { .data = "A", .name = "name0", }, /* Name alone is lowest priority */
1367 { .path = "/testcase-data/match-node/name0", .data = "A", },
1368 { .path = "/testcase-data/match-node/name1", .data = "B", },
1369 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1370 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1371 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1372 { .path = "/testcase-data/match-node/name3", .data = "E", },
1373 { .path = "/testcase-data/match-node/name4", .data = "G", },
1374 { .path = "/testcase-data/match-node/name5", .data = "H", },
1375 { .path = "/testcase-data/match-node/name6", .data = "G", },
1376 { .path = "/testcase-data/match-node/name7", .data = "I", },
1377 { .path = "/testcase-data/match-node/name8", .data = "J", },
1378 { .path = "/testcase-data/match-node/name9", .data = "K", },
1390 unittest(0, "missing testcase node %s\n", in of_unittest_match_node()
1402 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1405 (const char *)match->data); in of_unittest_match_node()
1414 .name = "unittest-bus",
1419 struct device_node *np, *child, *grandchild; in of_unittest_platform_populate() local
1422 { .compatible = "test-device", }, in of_unittest_platform_populate()
1426 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1429 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1430 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1436 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1437 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1439 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1440 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1445 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1450 "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found"); in of_unittest_platform_populate()
1452 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1453 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1456 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1468 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1471 * Add a dummy resource to the test bus node after it is in of_unittest_platform_populate()
1472 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1479 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1480 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1481 for_each_child_of_node(child, grandchild) { in of_unittest_platform_populate()
1484 "Could not create device for node '%pOFn'\n", in of_unittest_platform_populate()
1490 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1491 for_each_child_of_node(np, child) { in of_unittest_platform_populate()
1492 for_each_child_of_node(child, grandchild) in of_unittest_platform_populate()
1503 * update_node_properties - adds the properties
1504 * of np into dup node (present in live tree) and
1507 * @np: node whose properties are being added to the live tree
1508 * @dup: node present in live tree to be updated
1513 struct property *prop; in update_node_properties()
1514 struct property *save_next; in update_node_properties()
1515 struct device_node *child; in update_node_properties() local
1518 for_each_child_of_node(np, child) in update_node_properties()
1519 child->parent = dup; in update_node_properties()
1522 * "unittest internal error: unable to add testdata property" in update_node_properties()
1524 * If this message reports a property in node '/__symbols__' then in update_node_properties()
1525 * the respective unittest overlay contains a label that has the in update_node_properties()
1526 * same name as a label in the live devicetree. The label will in update_node_properties()
1528 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1531 * used in a real devicetree. in update_node_properties()
1536 * sets prop->next to NULL in update_node_properties()
1538 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1539 save_next = prop->next; in update_node_properties()
1542 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1544 pr_err("unittest internal error: unable to add testdata property %pOF/%s", in update_node_properties()
1545 np, prop->name); in update_node_properties()
1551 * attach_node_and_children - attaches nodes
1553 * CAUTION: misleading function name - if node @np already exists in
1556 * nodes do not have child nodes.
1558 * @np: Node to attach to live tree
1562 struct device_node *next, *dup, *child; in attach_node_and_children() local
1583 child = np->child; in attach_node_and_children()
1584 np->child = NULL; in attach_node_and_children()
1588 np->sibling = np->parent->child; in attach_node_and_children()
1589 np->parent->child = np; in attach_node_and_children()
1596 while (child) { in attach_node_and_children()
1597 next = child->sibling; in attach_node_and_children()
1598 attach_node_and_children(child); in attach_node_and_children()
1599 child = next; in attach_node_and_children()
1604 * unittest_data_add - Reads, copies data from
1618 const int size = __dtbo_testcases_end - __dtbo_testcases_begin; in unittest_data_add()
1624 return -ENODATA; in unittest_data_add()
1630 return -ENOMEM; in unittest_data_add()
1639 return -ENODATA; in unittest_data_add()
1644 return -ENODATA; in unittest_data_add()
1656 return -EINVAL; in unittest_data_add()
1670 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1672 /* attach the sub-tree to live tree */ in unittest_data_add()
1673 np = unittest_data_node->child; in unittest_data_add()
1675 struct device_node *next = np->sibling; in unittest_data_add()
1677 np->parent = of_root; in unittest_data_add()
1684 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1696 struct device *dev = &pdev->dev; in unittest_probe()
1697 struct device_node *np = dev->of_node; in unittest_probe()
1701 return -EINVAL; in unittest_probe()
1705 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_probe()
1707 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1714 struct device *dev = &pdev->dev; in unittest_remove()
1715 struct device_node *np = dev->of_node; in unittest_remove()
1717 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_remove()
1750 /* find out if a platform device exists at that path */
1774 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
1788 return -ENOMEM; in unittest_gpio_probe()
1792 devptr->chip.fwnode = dev_fwnode(&pdev->dev); in unittest_gpio_probe()
1793 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
1794 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
1795 devptr->chip.ngpio = 5; in unittest_gpio_probe()
1796 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
1798 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
1801 "gpiochip_add_data() for node @%pfw failed, ret = %d\n", devptr->chip.fwnode, ret); in unittest_gpio_probe()
1811 struct device *dev = &pdev->dev; in unittest_gpio_remove()
1813 dev_dbg(dev, "%s for node @%pfw\n", __func__, devptr->chip.fwnode); in unittest_gpio_remove()
1815 if (devptr->chip.base != -1) in unittest_gpio_remove()
1816 gpiochip_remove(&devptr->chip); in unittest_gpio_remove()
1822 { .compatible = "unittest-gpio", },
1830 .name = "unittest-gpio",
1843 * Similar to installing a driver as a module, the in of_unittest_overlay_gpio()
1851 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
1852 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
1853 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
1854 * - register driver in of_unittest_overlay_gpio()
1857 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
1858 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
1859 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
1866 * overlay_gpio_01 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1867 * overlay_gpio_02a contains gpio node in of_unittest_overlay_gpio()
1868 * overlay_gpio_02b contains child gpio hog node in of_unittest_overlay_gpio()
1889 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1894 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
1897 * overlay_gpio_03 contains gpio node and child gpio hog node in of_unittest_overlay_gpio()
1899 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
1902 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
1908 /* overlay_gpio_03 contains gpio node and child gpio hog node */ in of_unittest_overlay_gpio()
1918 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1921 * overlay_gpio_04a contains gpio node in of_unittest_overlay_gpio()
1923 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
1926 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
1932 /* overlay_gpio_04a contains gpio node */ in of_unittest_overlay_gpio()
1941 * overlay_gpio_04b contains child gpio hog node in of_unittest_overlay_gpio()
1943 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
1946 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
1949 /* overlay_gpio_04b contains child gpio hog node */ in of_unittest_overlay_gpio()
1956 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1986 /* find out if a i2c client device exists at that path */
1993 put_device(&client->dev); in of_path_i2c_client_exists()
2027 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
2030 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
2036 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
2037 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
2060 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
2062 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
2067 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
2090 track_ovcs_id_cnt--; in of_unittest_untrack_overlay()
2103 ovcs_id = track_ovcs_id[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2104 overlay_nr = track_ovcs_id_overlay_nr[track_ovcs_id_cnt - 1]; in of_unittest_remove_tracked_overlays()
2107 if (ret == -ENODEV) { in of_unittest_remove_tracked_overlays()
2130 return -EFAULT; in of_unittest_apply_overlay()
2149 return -EINVAL; in __of_unittest_apply_overlay_check()
2166 return -EINVAL; in __of_unittest_apply_overlay_check()
2214 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2226 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2232 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_0()
2246 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2252 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_1()
2267 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2273 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_2()
2286 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2292 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_3()
2300 /* test activation of a full device node */
2316 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2322 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_5()
2356 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2370 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2373 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2387 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_6()
2403 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2443 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2452 …RNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/t… in of_unittest_overlay_8()
2463 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2469 …mory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2483 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2494 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2498 * Should never get here. If we do, expect a lot of in of_unittest_overlay_8()
2509 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2524 /* test insertion of a bus with parent devices */
2537 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2545 unittest(ret, "overlay test %d failed; no child device\n", 10); in of_unittest_overlay_10()
2548 /* test insertion of a bus with parent devices (and revert) */
2589 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2590 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2597 return -EINVAL; in unittest_i2c_bus_probe()
2601 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_probe()
2605 return -ENOMEM; in unittest_i2c_bus_probe()
2608 std->pdev = pdev; in unittest_i2c_bus_probe()
2611 adap = &std->adap; in unittest_i2c_bus_probe()
2613 adap->nr = -1; in unittest_i2c_bus_probe()
2614 strscpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2615 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2616 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2617 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2618 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2619 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2620 adap->retries = 3; in unittest_i2c_bus_probe()
2633 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
2634 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
2637 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_bus_remove()
2638 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
2642 { .compatible = "unittest-i2c-bus", },
2650 .name = "unittest-i2c-bus",
2657 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
2658 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
2661 dev_err(dev, "No OF node\n"); in unittest_i2c_dev_probe()
2662 return -EINVAL; in unittest_i2c_dev_probe()
2665 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_probe()
2672 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
2673 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
2675 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_dev_remove()
2679 { .name = "unittest-i2c-dev" },
2685 .name = "unittest-i2c-dev",
2702 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
2703 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
2704 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe() local
2708 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_probe()
2711 dev_err(dev, "No OF node\n"); in unittest_i2c_mux_probe()
2712 return -EINVAL; in unittest_i2c_mux_probe()
2715 max_reg = (u32)-1; in unittest_i2c_mux_probe()
2716 for_each_child_of_node(np, child) { in unittest_i2c_mux_probe()
2717 if (of_property_read_u32(child, "reg", &reg)) in unittest_i2c_mux_probe()
2719 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
2722 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
2725 return -EINVAL; in unittest_i2c_mux_probe()
2731 return -ENOMEM; in unittest_i2c_mux_probe()
2736 return -ENODEV; in unittest_i2c_mux_probe()
2747 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
2748 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
2751 dev_dbg(dev, "%s for node @%pOF\n", __func__, np); in unittest_i2c_mux_remove()
2756 { .name = "unittest-i2c-mux" },
2762 .name = "unittest-i2c-mux",
2789 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2794 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2819 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2824 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_12()
2838 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2844 … memory leak will occur if overlay removed, property: /testcase-data/overlay-node/test-bus/i2c-tes… in of_unittest_overlay_i2c_13()
2863 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2868 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2894 * ret = -EBUSY which is -16. in of_notify()
2903 of_node_get(nd->overlay); in of_notify()
2908 found = of_find_node_by_name(nd->overlay, "test-unittest16"); in of_notify()
2911 ret = -EBUSY; in of_notify()
2916 found = of_find_node_by_name(nd->overlay, "test-unittest17"); in of_notify()
2919 ret = -EEXIST; in of_notify()
2924 found = of_find_node_by_name(nd->overlay, "test-unittest18"); in of_notify()
2927 ret = -EXDEV; in of_notify()
2932 found = of_find_node_by_name(nd->overlay, "test-unittest19"); in of_notify()
2935 ret = -ENODEV; in of_notify()
2940 of_node_put(nd->overlay); in of_notify()
2941 ret = -EINVAL; in of_notify()
2972 * Applying overlays 16 - 19 will each trigger an error for a in of_unittest_overlay_notify()
2978 /* --- overlay 16 --- */ in of_unittest_overlay_notify()
2980 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
2985 …_INFO, "OF: overlay: overlay changeset pre-apply notifier error -16, target: /testcase-data/overla… in of_unittest_overlay_notify()
2989 /* --- overlay 17 --- */ in of_unittest_overlay_notify()
2991 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
2996 …INFO, "OF: overlay: overlay changeset post-apply notifier error -17, target: /testcase-data/overla… in of_unittest_overlay_notify()
3000 /* --- overlay 18 --- */ in of_unittest_overlay_notify()
3008 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3011 …_INFO, "OF: overlay: overlay changeset pre-remove notifier error -18, target: /testcase-data/overl… in of_unittest_overlay_notify()
3012 if (ret == -EXDEV) { in of_unittest_overlay_notify()
3026 /* --- overlay 19 --- */ in of_unittest_overlay_notify()
3034 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3036 …INFO, "OF: overlay: overlay changeset post-remove notifier error -19, target: /testcase-data/overl… in of_unittest_overlay_notify()
3037 if (ret == -ENODEV) in of_unittest_overlay_notify()
3048 /* --- overlay 20 --- */ in of_unittest_overlay_notify()
3149 const char *refcount_path = "/testcase-data/refcount-node"; in of_unittest_lifecycle()
3150 const char *refcount_parent_path = "/testcase-data"; in of_unittest_lifecycle()
3153 * Node lifecycle tests, non-dynamic node: in of_unittest_lifecycle()
3155 * - Decrementing refcount to zero via of_node_put() should cause the in of_unittest_lifecycle()
3156 * attempt to free the node memory by of_node_release() to fail in of_unittest_lifecycle()
3157 * because the node is not a dynamic node. in of_unittest_lifecycle()
3159 * - Decrementing refcount past zero should result in additional in of_unittest_lifecycle()
3175 refcount = kref_read(&np->kobj.kref); in of_unittest_lifecycle()
3182 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3185 * refcount is now one, decrementing to zero will result in a call to in of_unittest_lifecycle()
3186 * of_node_release() to free the node's memory, which should result in of_unittest_lifecycle()
3189 unittest(1, "/testcase-data/refcount-node is one"); in of_unittest_lifecycle()
3192 …N_INFO, "OF: ERROR: of_node_release() detected bad of_node_put() on /testcase-data/refcount-node"); in of_unittest_lifecycle()
3203 EXPECT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3205 EXPECT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3206 EXPECT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3209 unittest(1, "/testcase-data/refcount-node is zero"); in of_unittest_lifecycle()
3212 EXPECT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3213 EXPECT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3215 EXPECT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3219 * A. no, the WARNING is from WARN_ONCE() in of_unittest_lifecycle()
3221 EXPECT_NOT_BEGIN(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3223 EXPECT_NOT_BEGIN(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3224 EXPECT_NOT_BEGIN(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3226 unittest(1, "/testcase-data/refcount-node is zero, second time"); in of_unittest_lifecycle()
3229 EXPECT_NOT_END(KERN_INFO, "---[ end trace <<int>> ]---"); in of_unittest_lifecycle()
3230 EXPECT_NOT_END(KERN_INFO, "refcount_t: underflow; use-after-free."); in of_unittest_lifecycle()
3232 EXPECT_NOT_END(KERN_INFO, "------------[ cut here ]------------"); in of_unittest_lifecycle()
3236 * attempt to of_node_get() node "refcount-node". One example of in of_unittest_lifecycle()
3239 * of_node_get() of the children of a node. in of_unittest_lifecycle()
3241 * Prevent the stack trace by removing node "refcount-node" from in of_unittest_lifecycle()
3242 * its parent's child list. in of_unittest_lifecycle()
3246 * Directly manipulate the child list of node /testcase-data to in of_unittest_lifecycle()
3247 * remove child refcount-node. This is ignoring all proper methods in of_unittest_lifecycle()
3248 * of removing a child and will leak a small amount of memory. in of_unittest_lifecycle()
3253 unittest(np, "ERROR: devicetree live tree left in a 'bad state' if test fail\n"); in of_unittest_lifecycle()
3257 prev_sibling = np->child; in of_unittest_lifecycle()
3258 next_sibling = prev_sibling->sibling; in of_unittest_lifecycle()
3259 if (!strcmp(prev_sibling->full_name, "refcount-node")) { in of_unittest_lifecycle()
3260 np->child = next_sibling; in of_unittest_lifecycle()
3261 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3264 if (!strcmp(next_sibling->full_name, "refcount-node")) in of_unittest_lifecycle()
3265 prev_sibling->sibling = next_sibling->sibling; in of_unittest_lifecycle()
3267 next_sibling = next_sibling->sibling; in of_unittest_lifecycle()
3343 OVERLAY_INFO(overlay_base, -9999, 0),
3360 OVERLAY_INFO(overlay_16, -EBUSY, 0),
3361 OVERLAY_INFO(overlay_17, -EEXIST, 0),
3372 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL, -ENODEV),
3373 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL, -ENODEV),
3374 OVERLAY_INFO(overlay_bad_phandle, -EINVAL, 0),
3375 OVERLAY_INFO(overlay_bad_symbol, -EINVAL, -ENODEV),
3376 OVERLAY_INFO(overlay_bad_unresolved, -EINVAL, 0),
3417 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
3418 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
3430 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
3435 data_size = info->dtbo_end - info->dtbo_begin; in unittest_unflatten_overlay_base()
3441 size = fdt_totalsize(info->dtbo_begin); in unittest_unflatten_overlay_base()
3453 memcpy(new_fdt, info->dtbo_begin, size); in unittest_unflatten_overlay_base()
3461 * overlay in the normal fashion. This is a test of the whole
3464 * A secondary purpose is to be able to verify that the contents of
3465 * /proc/device-tree/ contains the updated structure and values from
3478 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
3479 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3489 size = info->dtbo_end - info->dtbo_begin; in overlay_data_apply()
3493 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &info->ovcs_id, in overlay_data_apply()
3496 *ovcs_id = info->ovcs_id; in overlay_data_apply()
3503 if (ret != info->expected_result) { in overlay_data_apply()
3505 info->expected_result, ret, overlay_name); in overlay_data_apply()
3511 ret2 = of_overlay_remove(&info->ovcs_id); in overlay_data_apply()
3512 if (ret2 != info->expected_result_remove) { in overlay_data_apply()
3514 info->expected_result_remove, ret2, in overlay_data_apply()
3525 * in the normal fashion. This is a test of the whole picture,
3538 struct property *prop; in of_unittest_overlay_high_level()
3556 * do not allow overlay_base to duplicate any node already in in of_unittest_overlay_high_level()
3561 * remove overlay_base_root node "__local_fixups", after in of_unittest_overlay_high_level()
3564 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3565 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3567 *pprev = np->sibling; in of_unittest_overlay_high_level()
3570 pprev = &np->sibling; in of_unittest_overlay_high_level()
3573 /* remove overlay_base_root node "__symbols__" if in live tree */ in of_unittest_overlay_high_level()
3576 /* will have to graft properties from node into live tree */ in of_unittest_overlay_high_level()
3577 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3578 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3581 *pprev = np->sibling; in of_unittest_overlay_high_level()
3584 pprev = &np->sibling; in of_unittest_overlay_high_level()
3591 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3592 unittest(0, "illegal node name in overlay_base %pOFn", in of_unittest_overlay_high_level()
3605 * root node of *overlay_base_root will not be freed, it is lost in of_unittest_overlay_high_level()
3609 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3610 np->parent = of_root; in of_unittest_overlay_high_level()
3614 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3618 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3620 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3626 struct property *new_prop; in of_unittest_overlay_high_level()
3631 unittest(0, "__of_prop_dup() of '%s' from overlay_base node __symbols__", in of_unittest_overlay_high_level()
3632 prop->name); in of_unittest_overlay_high_level()
3636 kfree(new_prop->name); in of_unittest_overlay_high_level()
3637 kfree(new_prop->value); in of_unittest_overlay_high_level()
3639 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
3640 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
3642 unittest(0, "duplicate property '%s' in overlay_base node __symbols__", in of_unittest_overlay_high_level()
3643 prop->name); in of_unittest_overlay_high_level()
3647 unittest(0, "unable to add property '%s' in overlay_base node __symbols__ to sysfs", in of_unittest_overlay_high_level()
3648 prop->name); in of_unittest_overlay_high_level()
3659 /* --- overlay --- */ in of_unittest_overlay_high_level()
3662 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3664 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3666 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3668 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3670 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3672 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3674 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3676 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3678 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3680 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3682 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3687 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3689 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3691 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3693 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3695 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3697 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3699 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3701 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@4… in of_unittest_overlay_high_level()
3703 …: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/ride@100/track@3… in of_unittest_overlay_high_level()
3705 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-1/st… in of_unittest_overlay_high_level()
3707 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3711 /* --- overlay_bad_add_dup_node --- */ in of_unittest_overlay_high_level()
3714 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3716 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3718 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
3720 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3726 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3728 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/controller:n… in of_unittest_overlay_high_level()
3730 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3732 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3734 /* --- overlay_bad_add_dup_prop --- */ in of_unittest_overlay_high_level()
3737 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3739 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3741 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3743 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
3745 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3751 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3753 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/motor-1/electric:nam… in of_unittest_overlay_high_level()
3755 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3757 …ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/moto… in of_unittest_overlay_high_level()
3759 …: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor- in of_unittest_overlay_high_level()
3761 /* --- overlay_bad_phandle --- */ in of_unittest_overlay_high_level()
3766 /* --- overlay_bad_symbol --- */ in of_unittest_overlay_high_level()
3769 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
3771 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3777 "OF: Error reverting changeset (-19)"); in of_unittest_overlay_high_level()
3779 …"OF: changeset: apply failed: REMOVE_PROPERTY /testcase-data-2/substation@100/hvac-medium-2:name"); in of_unittest_overlay_high_level()
3781 /* --- overlay_bad_unresolved --- */ in of_unittest_overlay_high_level()
3784 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
3786 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
3792 "OF: resolver: overlay phandle fixup failed: -22"); in of_unittest_overlay_high_level()
3794 …"OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table"); in of_unittest_overlay_high_level()
3806 * PCI device tree node test driver
3820 dn = pdev->dev.of_node; in testdrv_probe()
3822 dev_err(&pdev->dev, "does not find bus endpoint"); in testdrv_probe()
3823 return -EINVAL; in testdrv_probe()
3826 for (info = overlays; info && info->name; info++) { in testdrv_probe()
3827 if (!strcmp(info->name, "overlay_pci_node")) in testdrv_probe()
3830 if (!info || !info->name) { in testdrv_probe()
3831 dev_err(&pdev->dev, "no overlay data for overlay_pci_node"); in testdrv_probe()
3832 return -ENODEV; in testdrv_probe()
3835 size = info->dtbo_end - info->dtbo_begin; in testdrv_probe()
3836 ret = of_overlay_fdt_apply(info->dtbo_begin, size, &ovcs_id, dn); in testdrv_probe()
3841 of_platform_default_populate(dn, NULL, &pdev->dev); in testdrv_probe()
3851 of_platform_depopulate(&pdev->dev); in testdrv_remove()
3870 return -ENODEV; in unittest_pci_probe()
3872 dev = &pdev->dev; in unittest_pci_probe()
3874 dev = dev->parent; in unittest_pci_probe()
3877 return -ENODEV; in unittest_pci_probe()
3881 unittest(res->start == exp_addr, "Incorrect translated address %llx, expected %llx\n", in unittest_pci_probe()
3882 (u64)res->start, exp_addr); in unittest_pci_probe()
3890 { .compatible = "unittest-pci" },
3897 .name = "unittest-pci",
3910 pnp = pdev->dev.of_node; in of_unittest_pci_node_verify()
3911 unittest(pnp, "Failed creating PCI dt node\n"); in of_unittest_pci_node_verify()
3913 return -ENODEV; in of_unittest_pci_node_verify()
3916 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0/unittest-pci@100", pnp); in of_unittest_pci_node_verify()
3918 unittest(np, "Failed to get unittest-pci node under PCI node\n"); in of_unittest_pci_node_verify()
3920 rc = -ENODEV; in of_unittest_pci_node_verify()
3925 unittest(reg, "Failed to get reg property\n"); in of_unittest_pci_node_verify()
3927 rc = -ENODEV; in of_unittest_pci_node_verify()
3929 path = kasprintf(GFP_KERNEL, "%pOF/pci-ep-bus@0", pnp); in of_unittest_pci_node_verify()
3931 unittest(!np, "Child device tree node is not removed\n"); in of_unittest_pci_node_verify()
3932 child_dev = device_find_any_child(&pdev->dev); in of_unittest_pci_node_verify()
3933 unittest(!child_dev, "Child device is not removed\n"); in of_unittest_pci_node_verify()
3971 "No test PCI device been found. Please run QEMU with '-device pci-testdev'\n"); in of_unittest_pci_node()
3973 "Child device number %d is not expected %d", of_unittest_pci_child_num, in of_unittest_pci_node()
3996 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
4012 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
4048 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()