Lines Matching +full:i +full:- +full:leak +full:- +full:current
1 // SPDX-License-Identifier: GPL-2.0
6 #define pr_fmt(fmt) "### dt-test ### " fmt
10 #include <linux/dma-direct.h> /* to test phys_to_dma/dma_to_phys */
28 #include <linux/i2c-mux.h>
44 pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
47 pr_debug("pass %s():%i\n", __func__, __LINE__); \
54 * Print the expected message only if the current loglevel will allow
71 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
73 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
74 "find /testcase-data failed\n"); in of_unittest_find_node_by_name()
79 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
80 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
82 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
84 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
85 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
89 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
91 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
92 "find testcase-alias 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()
98 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
100 np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
102 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
103 "find testcase-alias/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
107 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
108 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
111 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
112 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
115 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
116 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
119 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
124 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
129 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
134 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
138 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
144 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
150 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
155 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
170 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
183 /* Add a new property - should pass*/ in of_unittest_dynamic()
184 prop->name = "new-property"; in of_unittest_dynamic()
185 prop->value = "new-property-data"; in of_unittest_dynamic()
186 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
189 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
191 prop->name = "new-property"; in of_unittest_dynamic()
192 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
193 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
197 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
198 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
199 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
203 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
205 prop->name = "modify-property"; in of_unittest_dynamic()
206 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
207 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
211 /* Remove property - should pass */ in of_unittest_dynamic()
215 /* Adding very large property - should pass */ in of_unittest_dynamic()
217 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
218 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
219 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
220 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
221 if (prop->value) in of_unittest_dynamic()
232 if (child->parent != np) { in of_unittest_check_node_linkage()
235 rc = -EINVAL; in of_unittest_check_node_linkage()
265 "allnodes list size (%i) doesn't match sibling lists size (%i)\n", in of_unittest_check_tree_linkage()
267 pr_debug("allnodes list size (%i); sibling lists size (%i)\n", allnode_count, child_count); in of_unittest_check_tree_linkage()
275 int size, i; in of_unittest_printf_one() local
284 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
293 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
298 "snprintf failed; size=%i fmt='%s' expected='%s' rslt='%s'\n", in of_unittest_printf_one()
307 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
316 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
323 of_unittest_printf_one(np, "%pOFnc", "dev:test-sub-device"); in of_unittest_printf()
328 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
330 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
331 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
332 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
333 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
335 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
349 int i, dup_count = 0, phandle_count = 0; in of_unittest_check_phandles() local
352 if (!np->phandle) in of_unittest_check_phandles()
355 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
356 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
357 pr_info("Duplicate phandle! %i used by %pOF and %pOF\n", in of_unittest_check_phandles()
358 np->phandle, nh->np, np); in of_unittest_check_phandles()
368 nh->np = np; in of_unittest_check_phandles()
369 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
372 unittest(dup_count == 0, "Found %i duplicates in %i phandles\n", in of_unittest_check_phandles()
376 hash_for_each_safe(phandle_ht, i, tmp, nh, node) { in of_unittest_check_phandles()
377 hash_del(&nh->node); in of_unittest_check_phandles()
386 int i, rc; in of_unittest_parse_phandle_with_args() local
388 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
394 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
395 unittest(rc == 7, "of_count_phandle_with_args() returned %i, expected 7\n", rc); in of_unittest_parse_phandle_with_args()
397 for (i = 0; i < 8; i++) { in of_unittest_parse_phandle_with_args()
401 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
402 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
404 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
405 switch (i) { in of_unittest_parse_phandle_with_args()
409 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
414 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
418 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
423 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
430 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
440 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_phandle_with_args()
443 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
449 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
450 i, args.np, rc); in of_unittest_parse_phandle_with_args()
455 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
456 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
457 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
458 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
459 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
460 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
466 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
468 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
469 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
472 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
474 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
477 …"OF: /testcase-data/phandle-tests/consumer-a: could not get #phandle-cells-missing for /testcase-d… in of_unittest_parse_phandle_with_args()
479 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
480 "#phandle-cells-missing"); 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 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
491 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
493 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
494 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
497 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
499 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
502 "OF: /testcase-data/phandle-tests/consumer-a: could not find phandle"); in of_unittest_parse_phandle_with_args()
504 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
505 "#phandle-cells"); 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 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
516 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
518 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
519 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
522 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
524 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
527 "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1"); in of_unittest_parse_phandle_with_args()
529 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
530 "#phandle-cells"); 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 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
542 int i, rc; in of_unittest_parse_phandle_with_args_map() local
544 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
550 p0 = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
556 p1 = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
562 p2 = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
568 p3 = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); in of_unittest_parse_phandle_with_args_map()
574 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
575 unittest(rc == 7, "of_count_phandle_with_args() returned %i, expected 7\n", rc); in of_unittest_parse_phandle_with_args_map()
577 for (i = 0; i < 8; i++) { in of_unittest_parse_phandle_with_args_map()
581 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
582 "phandle", i, &args); in of_unittest_parse_phandle_with_args_map()
584 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
585 switch (i) { in of_unittest_parse_phandle_with_args_map()
601 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
627 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
633 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
634 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
639 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
641 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
647 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
649 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
650 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
652 …"OF: /testcase-data/phandle-tests/consumer-b: could not get #phandle-missing-cells for /testcase-d… in of_unittest_parse_phandle_with_args_map()
654 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
660 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle"); in of_unittest_parse_phandle_with_args_map()
662 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
665 "OF: /testcase-data/phandle-tests/consumer-b: could not find phandle"); in of_unittest_parse_phandle_with_args_map()
667 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
673 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); in of_unittest_parse_phandle_with_args_map()
675 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
678 "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1"); in of_unittest_parse_phandle_with_args_map()
680 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
689 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
695 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
696 unittest(rc == 0, "first expected:0 got:%i\n", rc); in of_unittest_property_string()
697 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
698 unittest(rc == 1, "second expected:1 got:%i\n", rc); in of_unittest_property_string()
699 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
700 unittest(rc == 2, "third expected:2 got:%i\n", rc); in of_unittest_property_string()
701 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
702 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
703 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
704 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
705 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
706 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
707 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
708 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
711 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
712 unittest(rc == 1, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
713 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
714 unittest(rc == 3, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
715 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
716 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
717 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
718 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
721 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
722 …unittest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i… in of_unittest_property_string()
724 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
725 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
726 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
727 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
728 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
729 …unittest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i… in of_unittest_property_string()
730 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
731 …unittest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
733 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
734 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
736 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
737 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
738 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
739 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
741 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
742 …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_array(np, "string-property", strings, 4); in of_unittest_property_string()
747 unittest(rc == 1, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
748 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
749 unittest(rc == 3, "Incorrect string count; rc=%i\n", rc); in of_unittest_property_string()
750 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
751 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
752 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
753 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
754 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
755 /* -- parsing the correctly formed strings should still work: */ in of_unittest_property_string()
757 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
758 unittest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc); in of_unittest_property_string()
760 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
761 …unittest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, st… in of_unittest_property_string()
764 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
765 (p1)->value && (p2)->value && \
766 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
767 !strcmp((p1)->name, (p2)->name))
777 kfree(new->value); in of_unittest_property_copy()
778 kfree(new->name); in of_unittest_property_copy()
782 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
783 kfree(new->value); in of_unittest_property_copy()
784 kfree(new->name); in of_unittest_property_copy()
792 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
796 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
810 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
811 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
830 n1->parent = parent; in of_unittest_changeset()
831 n2->parent = parent; in of_unittest_changeset()
832 n21->parent = n2; in of_unittest_changeset()
834 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
850 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
859 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
881 np = of_find_node_by_path("/testcase-data/address-tests"); in of_unittest_dma_get_max_cpu_address()
909 unittest(!rc, "of_dma_get_range failed on node %pOF rc=%i\n", np, rc); in of_unittest_dma_ranges_one()
935 of_unittest_dma_ranges_one("/testcase-data/address-tests/device@70000000", in of_unittest_parse_dma_ranges()
937 of_unittest_dma_ranges_one("/testcase-data/address-tests/bus@80000000/device@1000", in of_unittest_parse_dma_ranges()
939 of_unittest_dma_ranges_one("/testcase-data/address-tests/pci@90000000", in of_unittest_parse_dma_ranges()
948 int i = 0; in of_unittest_pci_dma_ranges() local
953 np = of_find_node_by_path("/testcase-data/address-tests/pci@90000000"); in of_unittest_pci_dma_ranges()
960 pr_err("missing dma-ranges property\n"); in of_unittest_pci_dma_ranges()
965 * Get the dma-ranges from the device tree in of_unittest_pci_dma_ranges()
968 if (!i) { in of_unittest_pci_dma_ranges()
989 i++; in of_unittest_pci_dma_ranges()
999 int i, rc; in of_unittest_parse_interrupts() local
1004 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
1010 for (i = 0; i < 4; i++) { in of_unittest_parse_interrupts()
1014 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1018 passed &= (args.args[0] == (i + 1)); in of_unittest_parse_interrupts()
1020 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1021 i, args.np, rc); in of_unittest_parse_interrupts()
1025 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
1031 for (i = 0; i < 4; i++) { in of_unittest_parse_interrupts()
1035 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts()
1037 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
1038 switch (i) { in of_unittest_parse_interrupts()
1066 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
1067 i, args.np, rc); in of_unittest_parse_interrupts()
1076 int i, rc; in of_unittest_parse_interrupts_extended() local
1081 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
1087 for (i = 0; i < 7; i++) { in of_unittest_parse_interrupts_extended()
1091 rc = of_irq_parse_one(np, i, &args); in of_unittest_parse_interrupts_extended()
1093 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
1094 switch (i) { in of_unittest_parse_interrupts_extended()
1140 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
1141 i, args.np, rc); in of_unittest_parse_interrupts_extended()
1157 { .data = "I", .compatible = "compat2", .type = "type1", },
1167 { .path = "/testcase-data/match-node/name0", .data = "A", },
1168 { .path = "/testcase-data/match-node/name1", .data = "B", },
1169 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
1170 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
1171 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
1172 { .path = "/testcase-data/match-node/name3", .data = "E", },
1173 { .path = "/testcase-data/match-node/name4", .data = "G", },
1174 { .path = "/testcase-data/match-node/name5", .data = "H", },
1175 { .path = "/testcase-data/match-node/name6", .data = "G", },
1176 { .path = "/testcase-data/match-node/name7", .data = "I", },
1177 { .path = "/testcase-data/match-node/name8", .data = "J", },
1178 { .path = "/testcase-data/match-node/name9", .data = "K", },
1185 int i; in of_unittest_match_node() local
1187 for (i = 0; i < ARRAY_SIZE(match_node_tests); i++) { in of_unittest_match_node()
1188 np = of_find_node_by_path(match_node_tests[i].path); in of_unittest_match_node()
1191 match_node_tests[i].path); in of_unittest_match_node()
1198 match_node_tests[i].path); in of_unittest_match_node()
1202 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
1204 match_node_tests[i].path, match_node_tests[i].data, in of_unittest_match_node()
1205 (const char *)match->data); in of_unittest_match_node()
1214 .name = "unittest-bus",
1222 { .compatible = "test-device", }, in of_unittest_platform_populate()
1226 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1229 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1230 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1236 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1237 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1239 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1240 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1245 "platform testcase-data:testcase-device2: IRQ index 0 not found"); in of_unittest_platform_populate()
1250 "platform testcase-data:testcase-device2: IRQ index 0 not found"); in of_unittest_platform_populate()
1252 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1253 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1256 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1263 unittest(!rc, "testbus registration failed; rc=%i\n", rc); in of_unittest_platform_populate()
1268 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1272 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1279 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1290 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1303 * update_node_properties - adds the properties
1319 child->parent = dup; in update_node_properties()
1328 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1336 * sets prop->next to NULL in update_node_properties()
1338 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1339 save_next = prop->next; in update_node_properties()
1342 if (ret == -EEXIST && !strcmp(prop->name, "name")) in update_node_properties()
1345 np, prop->name); in update_node_properties()
1351 * attach_node_and_children - attaches nodes
1353 * CAUTION: misleading function name - if node @np already exists in
1355 * tree. This works for the current test devicetree nodes because such
1381 child = np->child; in attach_node_and_children()
1382 np->child = NULL; in attach_node_and_children()
1386 np->sibling = np->parent->child; in attach_node_and_children()
1387 np->parent->child = np; in attach_node_and_children()
1395 next = child->sibling; in attach_node_and_children()
1402 * unittest_data_add - Reads, copies data from
1416 const int size = __dtb_testcases_end - __dtb_testcases_begin; in unittest_data_add()
1422 return -ENODATA; in unittest_data_add()
1428 return -ENOMEM; in unittest_data_add()
1437 return -ENODATA; in unittest_data_add()
1442 return -ENODATA; in unittest_data_add()
1452 pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc); in unittest_data_add()
1454 return -EINVAL; in unittest_data_add()
1468 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1470 /* attach the sub-tree to live tree */ in unittest_data_add()
1471 np = unittest_data_node->child; in unittest_data_add()
1473 struct device_node *next = np->sibling; in unittest_data_add()
1475 np->parent = of_root; in unittest_data_add()
1481 "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); in unittest_data_add()
1493 struct device *dev = &pdev->dev; in unittest_probe()
1494 struct device_node *np = dev->of_node; in unittest_probe()
1498 return -EINVAL; in unittest_probe()
1504 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1511 struct device *dev = &pdev->dev; in unittest_remove()
1512 struct device_node *np = dev->of_node; in unittest_remove()
1572 pr_debug("%s(): %s %d %d\n", __func__, chip->label, offset, in unittest_gpio_chip_request()
1586 return -ENOMEM; in unittest_gpio_probe()
1590 devptr->chip.of_node = pdev->dev.of_node; in unittest_gpio_probe()
1591 devptr->chip.label = "of-unittest-gpio"; in unittest_gpio_probe()
1592 devptr->chip.base = -1; /* dynamic allocation */ in unittest_gpio_probe()
1593 devptr->chip.ngpio = 5; in unittest_gpio_probe()
1594 devptr->chip.request = unittest_gpio_chip_request; in unittest_gpio_probe()
1596 ret = gpiochip_add_data(&devptr->chip, NULL); in unittest_gpio_probe()
1599 "gpiochip_add_data() for node @%pOF failed, ret = %d\n", devptr->chip.of_node, ret); in unittest_gpio_probe()
1609 struct device *dev = &pdev->dev; in unittest_gpio_remove()
1610 struct device_node *np = pdev->dev.of_node; in unittest_gpio_remove()
1615 return -EINVAL; in unittest_gpio_remove()
1617 if (gdev->chip.base != -1) in unittest_gpio_remove()
1618 gpiochip_remove(&gdev->chip); in unittest_gpio_remove()
1627 { .compatible = "unittest-gpio", },
1635 .name = "unittest-gpio",
1656 * - apply overlay_gpio_01 in of_unittest_overlay_gpio()
1657 * - apply overlay_gpio_02a in of_unittest_overlay_gpio()
1658 * - apply overlay_gpio_02b in of_unittest_overlay_gpio()
1659 * - register driver in of_unittest_overlay_gpio()
1662 * - probe and processing gpio hog for overlay_gpio_01 in of_unittest_overlay_gpio()
1663 * - probe for overlay_gpio_02a in of_unittest_overlay_gpio()
1664 * - processing gpio for overlay_gpio_02b in of_unittest_overlay_gpio()
1691 "GPIO line <<int>> (line-B-input) hogged as input\n"); in of_unittest_overlay_gpio()
1694 "GPIO line <<int>> (line-A-input) hogged as input\n"); in of_unittest_overlay_gpio()
1701 "GPIO line <<int>> (line-A-input) hogged as input\n"); in of_unittest_overlay_gpio()
1703 "GPIO line <<int>> (line-B-input) hogged as input\n"); in of_unittest_overlay_gpio()
1710 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1715 * Similar to a driver built-in to the kernel, the in of_unittest_overlay_gpio()
1720 * - apply overlay_gpio_03 in of_unittest_overlay_gpio()
1723 * - probe and processing gpio hog. in of_unittest_overlay_gpio()
1730 "GPIO line <<int>> (line-D-input) hogged as input\n"); in of_unittest_overlay_gpio()
1738 "GPIO line <<int>> (line-D-input) hogged as input\n"); in of_unittest_overlay_gpio()
1745 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1750 * - apply overlay_gpio_04a in of_unittest_overlay_gpio()
1753 * - probe for overlay_gpio_04a in of_unittest_overlay_gpio()
1770 * - apply overlay_gpio_04b in of_unittest_overlay_gpio()
1773 * - processing gpio for overlay_gpio_04b in of_unittest_overlay_gpio()
1777 "GPIO line <<int>> (line-C-input) hogged as input\n"); in of_unittest_overlay_gpio()
1785 "GPIO line <<int>> (line-C-input) hogged as input\n"); in of_unittest_overlay_gpio()
1789 unittest_gpio_chip_request_count - chip_request_count); in of_unittest_overlay_gpio()
1826 put_device(&client->dev); in of_path_i2c_client_exists()
1860 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
1863 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
1869 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
1870 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
1893 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
1895 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
1900 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
1906 static int overlay_first_id = -1;
1919 id -= overlay_first_id; in of_unittest_track_overlay()
1930 id -= overlay_first_id; in of_unittest_untrack_overlay()
1947 for (id = MAX_UNITTEST_OVERLAYS - 1; id >= 0; id--) { in of_unittest_destroy_tracked_overlays()
1953 if (ret == -ENODEV) { in of_unittest_destroy_tracked_overlays()
1979 return -EFAULT; in of_unittest_apply_overlay()
1999 return -EINVAL; in of_unittest_apply_overlay_check()
2015 return -EINVAL; in of_unittest_apply_overlay_check()
2034 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2051 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2070 return -EINVAL; in of_unittest_apply_revert_overlay_check()
2082 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_0()
2088 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_0()
2102 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_1()
2108 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_1()
2123 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_2()
2129 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_2()
2142 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_3()
2148 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_3()
2172 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_5()
2178 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_5()
2189 int i, ov_id[2], ovcs_id; in of_unittest_overlay_6() local
2197 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2198 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2201 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2202 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2212 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_6()
2226 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_6()
2229 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_6()
2243 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_6()
2246 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2248 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2251 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2252 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2259 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
2260 ovcs_id = ov_id[i]; in of_unittest_overlay_6()
2263 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2264 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2268 of_unittest_untrack_overlay(ov_id[i]); in of_unittest_overlay_6()
2271 for (i = 0; i < 2; i++) { in of_unittest_overlay_6()
2273 if (of_unittest_device_exists(unittest_nr + i, PDEV_OVERLAY) in of_unittest_overlay_6()
2276 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_6()
2277 unittest_path(unittest_nr + i, in of_unittest_overlay_6()
2291 int i, ov_id[2], ovcs_id; in of_unittest_overlay_8() local
2299 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_8()
2308 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay… in of_unittest_overlay_8()
2319 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/t… in of_unittest_overlay_8()
2325 …erlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-node/t… in of_unittest_overlay_8()
2339 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2350 …rlay: node_overlaps_later_cs: #6 overlaps with #7 @/testcase-data/overlay-node/test-bus/test-unitt… in of_unittest_overlay_8()
2361 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
2362 ovcs_id = ov_id[i]; in of_unittest_overlay_8()
2365 overlay_name_from_nr(overlay_nr + i), in of_unittest_overlay_8()
2370 of_unittest_untrack_overlay(ov_id[i]); in of_unittest_overlay_8()
2389 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
2441 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
2442 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
2449 return -EINVAL; in unittest_i2c_bus_probe()
2457 return -ENOMEM; in unittest_i2c_bus_probe()
2460 std->pdev = pdev; in unittest_i2c_bus_probe()
2463 adap = &std->adap; in unittest_i2c_bus_probe()
2465 adap->nr = -1; in unittest_i2c_bus_probe()
2466 strlcpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
2467 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
2468 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
2469 adap->dev.parent = dev; in unittest_i2c_bus_probe()
2470 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
2471 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
2472 adap->retries = 3; in unittest_i2c_bus_probe()
2485 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
2486 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
2490 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
2496 { .compatible = "unittest-i2c-bus", },
2504 .name = "unittest-i2c-bus",
2512 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
2513 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
2517 return -EINVAL; in unittest_i2c_dev_probe()
2527 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
2528 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
2535 { .name = "unittest-i2c-dev" },
2541 .name = "unittest-i2c-dev",
2558 int i, nchans; in unittest_i2c_mux_probe() local
2559 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
2560 struct i2c_adapter *adap = client->adapter; in unittest_i2c_mux_probe()
2561 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe()
2569 return -EINVAL; in unittest_i2c_mux_probe()
2572 max_reg = (u32)-1; in unittest_i2c_mux_probe()
2576 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
2579 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
2582 return -EINVAL; in unittest_i2c_mux_probe()
2588 return -ENOMEM; in unittest_i2c_mux_probe()
2589 for (i = 0; i < nchans; i++) { in unittest_i2c_mux_probe()
2590 if (i2c_mux_add_adapter(muxc, 0, i, 0)) { in unittest_i2c_mux_probe()
2591 dev_err(dev, "Failed to register mux #%d\n", i); in unittest_i2c_mux_probe()
2593 return -ENODEV; in unittest_i2c_mux_probe()
2604 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
2605 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
2614 { .name = "unittest-i2c-mux" },
2620 .name = "unittest-i2c-mux",
2647 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2652 "i2c i2c-1: Added multiplexed i2c bus 2"); in of_unittest_overlay_i2c_init()
2677 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_12()
2682 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_12()
2696 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_13()
2702 … overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data/overlay-nod… in of_unittest_overlay_i2c_13()
2721 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2726 "i2c i2c-1: Added multiplexed i2c bus 3"); in of_unittest_overlay_i2c_15()
2868 OVERLAY_INFO(overlay_base, -9999),
2891 OVERLAY_INFO(overlay_bad_add_dup_node, -EINVAL),
2892 OVERLAY_INFO(overlay_bad_add_dup_prop, -EINVAL),
2893 OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
2894 OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
2935 for (info = overlays; info && info->name; info++) { in unittest_unflatten_overlay_base()
2936 if (!strcmp(overlay_name, info->name)) { in unittest_unflatten_overlay_base()
2948 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
2953 data_size = info->dtb_end - info->dtb_begin; in unittest_unflatten_overlay_base()
2959 size = fdt_totalsize(info->dtb_begin); in unittest_unflatten_overlay_base()
2971 memcpy(new_fdt, info->dtb_begin, size); in unittest_unflatten_overlay_base()
2983 * /proc/device-tree/ contains the updated structure and values from
2995 for (info = overlays; info && info->name; info++) { in overlay_data_apply()
2996 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
3006 size = info->dtb_end - info->dtb_begin; in overlay_data_apply()
3010 ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->overlay_id); in overlay_data_apply()
3012 *overlay_id = info->overlay_id; in overlay_data_apply()
3019 if (ret != info->expected_result) in overlay_data_apply()
3021 info->expected_result, ret, overlay_name); in overlay_data_apply()
3023 return (ret == info->expected_result); in overlay_data_apply()
3067 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3068 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3070 *pprev = np->sibling; in of_unittest_overlay_high_level()
3073 pprev = &np->sibling; in of_unittest_overlay_high_level()
3080 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
3081 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
3084 *pprev = np->sibling; in of_unittest_overlay_high_level()
3087 pprev = &np->sibling; in of_unittest_overlay_high_level()
3094 if (!strcmp(np->full_name, base_child->full_name)) { in of_unittest_overlay_high_level()
3110 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3111 np->parent = of_root; in of_unittest_overlay_high_level()
3115 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
3119 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
3121 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
3133 prop->name); in of_unittest_overlay_high_level()
3137 kfree(new_prop->name); in of_unittest_overlay_high_level()
3138 kfree(new_prop->value); in of_unittest_overlay_high_level()
3140 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
3141 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
3144 prop->name); in of_unittest_overlay_high_level()
3149 prop->name); in of_unittest_overlay_high_level()
3161 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3163 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairw… in of_unittest_overlay_high_level()
3165 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-… in of_unittest_overlay_high_level()
3167 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-… in of_unittest_overlay_high_level()
3169 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3171 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3173 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3175 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3177 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3179 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3181 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3186 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3188 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200_… in of_unittest_overlay_high_level()
3190 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/ride_200"… in of_unittest_overlay_high_level()
3192 … "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /__symbols__/hvac_2"); in of_unittest_overlay_high_level()
3194 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3196 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3198 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/light… in of_unittest_overlay_high_level()
3200 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-… in of_unittest_overlay_high_level()
3202 …: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairway-… in of_unittest_overlay_high_level()
3204 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/fairw… in of_unittest_overlay_high_level()
3206 …"OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/subst… in of_unittest_overlay_high_level()
3211 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
3213 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
3219 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
3221 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/contr… in of_unittest_overlay_high_level()
3224 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3226 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3228 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3234 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3236 …ltiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3238 …ay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/elect… in of_unittest_overlay_high_level()
3263 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
3276 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
3307 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()