• Home
  • Raw
  • Download

Lines Matching +full:enabled +full:- +full:strings

1 // SPDX-License-Identifier: GPL-2.0
6 #define pr_fmt(fmt) "### dt-test ### " fmt
25 #include <linux/i2c-mux.h>
53 np = of_find_node_by_path("/testcase-data"); in of_unittest_find_node_by_name()
55 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
56 "find /testcase-data failed\n"); in of_unittest_find_node_by_name()
61 np = of_find_node_by_path("/testcase-data/"); in of_unittest_find_node_by_name()
62 unittest(!np, "trailing '/' on /testcase-data/ should fail\n"); in of_unittest_find_node_by_name()
64 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_find_node_by_name()
66 unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name), in of_unittest_find_node_by_name()
67 "find /testcase-data/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
71 np = of_find_node_by_path("testcase-alias"); in of_unittest_find_node_by_name()
73 unittest(np && !strcmp("/testcase-data", name), in of_unittest_find_node_by_name()
74 "find testcase-alias failed\n"); in of_unittest_find_node_by_name()
79 np = of_find_node_by_path("testcase-alias/"); in of_unittest_find_node_by_name()
80 unittest(!np, "trailing '/' on testcase-alias/ should fail\n"); in of_unittest_find_node_by_name()
82 np = of_find_node_by_path("testcase-alias/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-alias/phandle-tests/consumer-a failed\n"); in of_unittest_find_node_by_name()
89 np = of_find_node_by_path("/testcase-data/missing-path"); in of_unittest_find_node_by_name()
90 unittest(!np, "non-existent path returned node %pOF\n", np); in of_unittest_find_node_by_name()
93 np = of_find_node_by_path("missing-alias"); in of_unittest_find_node_by_name()
94 unittest(!np, "non-existent alias returned node %pOF\n", np); in of_unittest_find_node_by_name()
97 np = of_find_node_by_path("testcase-alias/missing-path"); in of_unittest_find_node_by_name()
98 unittest(!np, "non-existent alias with relative path returned node %pOF\n", np); in of_unittest_find_node_by_name()
101 np = of_find_node_opts_by_path("/testcase-data:testoption", &options); in of_unittest_find_node_by_name()
106 np = of_find_node_opts_by_path("/testcase-data:test/option", &options); in of_unittest_find_node_by_name()
111 np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); in of_unittest_find_node_by_name()
116 np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); in of_unittest_find_node_by_name()
120 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", in of_unittest_find_node_by_name()
126 np = of_find_node_opts_by_path("testcase-alias:test/alias/option", in of_unittest_find_node_by_name()
132 np = of_find_node_opts_by_path("testcase-alias:testaliasoption", NULL); in of_unittest_find_node_by_name()
137 np = of_find_node_opts_by_path("testcase-alias", &options); in of_unittest_find_node_by_name()
152 np = of_find_node_by_path("/testcase-data"); in of_unittest_dynamic()
165 /* Add a new property - should pass*/ in of_unittest_dynamic()
166 prop->name = "new-property"; in of_unittest_dynamic()
167 prop->value = "new-property-data"; in of_unittest_dynamic()
168 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
171 /* Try to add an existing property - should fail */ in of_unittest_dynamic()
173 prop->name = "new-property"; in of_unittest_dynamic()
174 prop->value = "new-property-data-should-fail"; in of_unittest_dynamic()
175 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
179 /* Try to modify an existing property - should pass */ in of_unittest_dynamic()
180 prop->value = "modify-property-data-should-pass"; in of_unittest_dynamic()
181 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
185 /* Try to modify non-existent property - should pass*/ in of_unittest_dynamic()
187 prop->name = "modify-property"; in of_unittest_dynamic()
188 prop->value = "modify-missing-property-data-should-pass"; in of_unittest_dynamic()
189 prop->length = strlen(prop->value) + 1; in of_unittest_dynamic()
193 /* Remove property - should pass */ in of_unittest_dynamic()
197 /* Adding very large property - should pass */ in of_unittest_dynamic()
199 prop->name = "large-property-PAGE_SIZEx8"; in of_unittest_dynamic()
200 prop->length = PAGE_SIZE * 8; in of_unittest_dynamic()
201 prop->value = kzalloc(prop->length, GFP_KERNEL); in of_unittest_dynamic()
202 unittest(prop->value != NULL, "Unable to allocate large buffer\n"); in of_unittest_dynamic()
203 if (prop->value) in of_unittest_dynamic()
214 if (child->parent != np) { in of_unittest_check_node_linkage()
217 rc = -EINVAL; in of_unittest_check_node_linkage()
266 size = snprintf(buf, buf_size - 2, fmt, np); in of_unittest_printf_one()
268 /* use strcmp() instead of strncmp() here to be absolutely sure strings match */ in of_unittest_printf_one()
275 for (i = 0; i < 2; i++, size--) { in of_unittest_printf_one()
289 const char *full_name = "/testcase-data/platform-tests/test-device@1/dev@100"; in of_unittest_printf()
298 num_to_str(phandle_str, sizeof(phandle_str), np->phandle, 0); in of_unittest_printf()
306 of_unittest_printf_one(np, "%-10pOFP", "dev@100 "); in of_unittest_printf()
308 of_unittest_printf_one(np, "%pOFF", "----"); in of_unittest_printf()
309 of_unittest_printf_one(np, "%pOFPF", "dev@100:----"); in of_unittest_printf()
310 of_unittest_printf_one(np, "%pOFPFPc", "dev@100:----:dev@100:test-sub-device"); in of_unittest_printf()
311 of_unittest_printf_one(np, "%pOFc", "test-sub-device"); in of_unittest_printf()
313 "\"test-sub-device\",\"test-compat2\",\"test-compat3\""); in of_unittest_printf()
330 if (!np->phandle) in of_unittest_check_phandles()
333 hash_for_each_possible(phandle_ht, nh, node, np->phandle) { in of_unittest_check_phandles()
334 if (nh->np->phandle == np->phandle) { in of_unittest_check_phandles()
336 np->phandle, nh->np, np); in of_unittest_check_phandles()
346 nh->np = np; in of_unittest_check_phandles()
347 hash_add(phandle_ht, &nh->node, np->phandle); in of_unittest_check_phandles()
355 hash_del(&nh->node); in of_unittest_check_phandles()
366 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_parse_phandle_with_args()
372 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args()
379 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
380 "#phandle-cells", i, &args); in of_unittest_parse_phandle_with_args()
382 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args()
396 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
421 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args()
427 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_phandle_with_args()
433 rc = of_parse_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
434 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
435 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
436 rc = of_count_phandle_with_args(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args()
437 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
438 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args()
442 rc = of_parse_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
443 "#phandle-cells-missing", 0, &args); in of_unittest_parse_phandle_with_args()
444 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
445 rc = of_count_phandle_with_args(np, "phandle-list", in of_unittest_parse_phandle_with_args()
446 "#phandle-cells-missing"); in of_unittest_parse_phandle_with_args()
447 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
451 rc = of_parse_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
452 "#phandle-cells", 0, &args); in of_unittest_parse_phandle_with_args()
453 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
454 rc = of_count_phandle_with_args(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args()
455 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
456 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
460 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
461 "#phandle-cells", 1, &args); in of_unittest_parse_phandle_with_args()
462 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
463 rc = of_count_phandle_with_args(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args()
464 "#phandle-cells"); in of_unittest_parse_phandle_with_args()
465 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args()
474 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-b"); in of_unittest_parse_phandle_with_args_map()
480 p0 = of_find_node_by_path("/testcase-data/phandle-tests/provider0"); in of_unittest_parse_phandle_with_args_map()
486 p1 = of_find_node_by_path("/testcase-data/phandle-tests/provider1"); in of_unittest_parse_phandle_with_args_map()
492 p2 = of_find_node_by_path("/testcase-data/phandle-tests/provider2"); in of_unittest_parse_phandle_with_args_map()
498 p3 = of_find_node_by_path("/testcase-data/phandle-tests/provider3"); in of_unittest_parse_phandle_with_args_map()
504 rc = of_count_phandle_with_args(np, "phandle-list", "#phandle-cells"); in of_unittest_parse_phandle_with_args_map()
511 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
514 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_phandle_with_args_map()
531 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
557 passed &= (rc == -ENOENT); in of_unittest_parse_phandle_with_args_map()
563 unittest(passed, "index %i - data error on node %s rc=%i\n", in of_unittest_parse_phandle_with_args_map()
564 i, args.np->full_name, rc); in of_unittest_parse_phandle_with_args_map()
569 rc = of_parse_phandle_with_args_map(np, "phandle-list-missing", in of_unittest_parse_phandle_with_args_map()
571 unittest(rc == -ENOENT, "expected:%i got:%i\n", -ENOENT, rc); in of_unittest_parse_phandle_with_args_map()
575 rc = of_parse_phandle_with_args_map(np, "phandle-list", in of_unittest_parse_phandle_with_args_map()
576 "phandle-missing", 0, &args); in of_unittest_parse_phandle_with_args_map()
577 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
581 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-phandle", in of_unittest_parse_phandle_with_args_map()
583 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
587 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args", in of_unittest_parse_phandle_with_args_map()
589 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); in of_unittest_parse_phandle_with_args_map()
594 const char *strings[4]; in of_unittest_property_string() local
598 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest_property_string()
604 rc = of_property_match_string(np, "phandle-list-names", "first"); in of_unittest_property_string()
606 rc = of_property_match_string(np, "phandle-list-names", "second"); in of_unittest_property_string()
608 rc = of_property_match_string(np, "phandle-list-names", "third"); in of_unittest_property_string()
610 rc = of_property_match_string(np, "phandle-list-names", "fourth"); in of_unittest_property_string()
611 unittest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); in of_unittest_property_string()
612 rc = of_property_match_string(np, "missing-property", "blah"); in of_unittest_property_string()
613 unittest(rc == -EINVAL, "missing property; rc=%i\n", rc); in of_unittest_property_string()
614 rc = of_property_match_string(np, "empty-property", "blah"); in of_unittest_property_string()
615 unittest(rc == -ENODATA, "empty property; rc=%i\n", rc); in of_unittest_property_string()
616 rc = of_property_match_string(np, "unterminated-string", "blah"); in of_unittest_property_string()
617 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
620 rc = of_property_count_strings(np, "string-property"); in of_unittest_property_string()
622 rc = of_property_count_strings(np, "phandle-list-names"); in of_unittest_property_string()
624 rc = of_property_count_strings(np, "unterminated-string"); in of_unittest_property_string()
625 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
626 rc = of_property_count_strings(np, "unterminated-string-list"); in of_unittest_property_string()
627 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
630 rc = of_property_read_string_index(np, "string-property", 0, strings); in of_unittest_property_string()
631 …unittest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i… in of_unittest_property_string()
632 strings[0] = NULL; in of_unittest_property_string()
633 rc = of_property_read_string_index(np, "string-property", 1, strings); in of_unittest_property_string()
634 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
635 rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); in of_unittest_property_string()
636 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
637 rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); in of_unittest_property_string()
638 …unittest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i… in of_unittest_property_string()
639 rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); in of_unittest_property_string()
640 …unittest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
641 strings[0] = NULL; in of_unittest_property_string()
642 rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); in of_unittest_property_string()
643 …unittest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n",… in of_unittest_property_string()
644 strings[0] = NULL; in of_unittest_property_string()
645 rc = of_property_read_string_index(np, "unterminated-string", 0, strings); in of_unittest_property_string()
646 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
647 rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); in of_unittest_property_string()
648 …unittest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\… in of_unittest_property_string()
649 strings[0] = NULL; in of_unittest_property_string()
650 rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ in of_unittest_property_string()
651 …unittest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", … in of_unittest_property_string()
652 strings[1] = NULL; in of_unittest_property_string()
655 rc = of_property_read_string_array(np, "string-property", strings, 4); in of_unittest_property_string()
657 rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); in of_unittest_property_string()
659 rc = of_property_read_string_array(np, "unterminated-string", strings, 4); in of_unittest_property_string()
660 unittest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); in of_unittest_property_string()
661 /* -- An incorrectly formed string should cause a failure */ in of_unittest_property_string()
662 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); in of_unittest_property_string()
663 unittest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); in of_unittest_property_string()
664 /* -- parsing the correctly formed strings should still work: */ in of_unittest_property_string()
665 strings[2] = NULL; in of_unittest_property_string()
666 rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); in of_unittest_property_string()
667 unittest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc); in of_unittest_property_string()
668 strings[1] = NULL; in of_unittest_property_string()
669 rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); in of_unittest_property_string()
670 …unittest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, st… in of_unittest_property_string()
673 #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \
674 (p1)->value && (p2)->value && \
675 !memcmp((p1)->value, (p2)->value, (p1)->length) && \
676 !strcmp((p1)->name, (p2)->name))
686 kfree(new->value); in of_unittest_property_copy()
687 kfree(new->name); in of_unittest_property_copy()
691 unittest(new && propcmp(&p2, new), "non-empty property didn't copy correctly\n"); in of_unittest_property_copy()
692 kfree(new->value); in of_unittest_property_copy()
693 kfree(new->name); in of_unittest_property_copy()
701 struct property *ppadd, padd = { .name = "prop-add", .length = 1, .value = "" }; in of_unittest_changeset()
705 struct property *ppupdate, pupdate = { .name = "prop-update", .length = 5, .value = "abcd" }; in of_unittest_changeset()
719 nchangeset = of_find_node_by_path("/testcase-data/changeset"); in of_unittest_changeset()
720 nremove = of_get_child_by_name(nchangeset, "node-remove"); in of_unittest_changeset()
739 n1->parent = parent; in of_unittest_changeset()
740 n2->parent = parent; in of_unittest_changeset()
741 n21->parent = n2; in of_unittest_changeset()
743 ppremove = of_find_property(parent, "prop-remove", NULL); in of_unittest_changeset()
759 unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop prop-add\n"); in of_unittest_changeset()
768 unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")), in of_unittest_changeset()
791 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); in of_unittest_parse_interrupts()
807 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
812 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); in of_unittest_parse_interrupts()
824 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts()
853 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts()
868 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); in of_unittest_parse_interrupts_extended()
880 /* Test the values from tests-phandle.dtsi */ in of_unittest_parse_interrupts_extended()
927 unittest(passed, "index %i - data error on node %pOF rc=%i\n", in of_unittest_parse_interrupts_extended()
954 { .path = "/testcase-data/match-node/name0", .data = "A", },
955 { .path = "/testcase-data/match-node/name1", .data = "B", },
956 { .path = "/testcase-data/match-node/a/name2", .data = "Ca", },
957 { .path = "/testcase-data/match-node/b/name2", .data = "Cb", },
958 { .path = "/testcase-data/match-node/c/name2", .data = "Cc", },
959 { .path = "/testcase-data/match-node/name3", .data = "E", },
960 { .path = "/testcase-data/match-node/name4", .data = "G", },
961 { .path = "/testcase-data/match-node/name5", .data = "H", },
962 { .path = "/testcase-data/match-node/name6", .data = "G", },
963 { .path = "/testcase-data/match-node/name7", .data = "I", },
964 { .path = "/testcase-data/match-node/name8", .data = "J", },
965 { .path = "/testcase-data/match-node/name9", .data = "K", },
989 if (strcmp(match->data, match_node_tests[i].data) != 0) { in of_unittest_match_node()
992 (const char *)match->data); in of_unittest_match_node()
1005 .name = "unittest-bus",
1013 { .compatible = "test-device", }, in of_unittest_platform_populate()
1017 np = of_find_node_by_path("/testcase-data"); in of_unittest_platform_populate()
1020 /* Test that a missing irq domain returns -EPROBE_DEFER */ in of_unittest_platform_populate()
1021 np = of_find_node_by_path("/testcase-data/testcase-device1"); in of_unittest_platform_populate()
1027 unittest(irq == -EPROBE_DEFER, in of_unittest_platform_populate()
1028 "device deferred probe failed - %d\n", irq); in of_unittest_platform_populate()
1030 /* Test that a parsing failure does not return -EPROBE_DEFER */ in of_unittest_platform_populate()
1031 np = of_find_node_by_path("/testcase-data/testcase-device2"); in of_unittest_platform_populate()
1035 unittest(irq < 0 && irq != -EPROBE_DEFER, in of_unittest_platform_populate()
1036 "device parsing error failed - %d\n", irq); in of_unittest_platform_populate()
1039 np = of_find_node_by_path("/testcase-data/platform-tests"); in of_unittest_platform_populate()
1049 test_bus->dev.of_node = np; in of_unittest_platform_populate()
1053 * registered to catch problems with un-inserted resources. The in of_unittest_platform_populate()
1060 of_platform_populate(np, match, NULL, &test_bus->dev); in of_unittest_platform_populate()
1071 of_platform_depopulate(&test_bus->dev); in of_unittest_platform_populate()
1084 * update_node_properties - adds the properties
1100 child->parent = dup; in update_node_properties()
1109 * compiled with the '-@' option. If you encounter this error, in update_node_properties()
1117 * sets prop->next to NULL in update_node_properties()
1119 for (prop = np->properties; prop != NULL; prop = save_next) { in update_node_properties()
1120 save_next = prop->next; in update_node_properties()
1124 np, prop->name); in update_node_properties()
1129 * attach_node_and_children - attaches nodes
1155 child = np->child; in attach_node_and_children()
1156 np->child = NULL; in attach_node_and_children()
1160 np->sibling = np->parent->child; in attach_node_and_children()
1161 np->parent->child = np; in attach_node_and_children()
1169 next = child->sibling; in attach_node_and_children()
1176 * unittest_data_add - Reads, copies data from
1189 const int size = __dtb_testcases_end - __dtb_testcases_begin; in unittest_data_add()
1195 return -ENODATA; in unittest_data_add()
1204 return -ENOMEM; in unittest_data_add()
1210 return -ENODATA; in unittest_data_add()
1222 return -EINVAL; in unittest_data_add()
1235 /* attach the sub-tree to live tree */ in unittest_data_add()
1236 np = unittest_data_node->child; in unittest_data_add()
1238 struct device_node *next = np->sibling; in unittest_data_add()
1240 np->parent = of_root; in unittest_data_add()
1255 struct device *dev = &pdev->dev; in unittest_probe()
1256 struct device_node *np = dev->of_node; in unittest_probe()
1260 return -EINVAL; in unittest_probe()
1266 of_platform_populate(np, NULL, NULL, &pdev->dev); in unittest_probe()
1273 struct device *dev = &pdev->dev; in unittest_remove()
1274 struct device_node *np = dev->of_node; in unittest_remove()
1345 put_device(&client->dev); in of_path_i2c_client_exists()
1379 base = "/testcase-data/overlay-node/test-bus"; in unittest_path()
1382 base = "/testcase-data/overlay-node/test-bus/i2c-test-bus"; in unittest_path()
1388 snprintf(buf, sizeof(buf) - 1, "%s/test-unittest%d", base, nr); in unittest_path()
1389 buf[sizeof(buf) - 1] = '\0'; in unittest_path()
1412 snprintf(buf, sizeof(buf) - 1, in overlay_name_from_nr()
1414 buf[sizeof(buf) - 1] = '\0'; in overlay_name_from_nr()
1419 static const char *bus_path = "/testcase-data/overlay-node/test-bus";
1424 static int overlay_first_id = -1;
1430 id -= overlay_first_id; in of_unittest_track_overlay()
1441 id -= overlay_first_id; in of_unittest_untrack_overlay()
1457 for (id = MAX_UNITTEST_OVERLAYS - 1; id >= 0; id--) { in of_unittest_destroy_tracked_overlays()
1463 if (ret == -ENODEV) { in of_unittest_destroy_tracked_overlays()
1490 return -EFAULT; in of_unittest_apply_overlay()
1509 !before ? "enabled" : "disabled"); in of_unittest_apply_overlay_check()
1510 return -EINVAL; in of_unittest_apply_overlay_check()
1525 !after ? "enabled" : "disabled"); in of_unittest_apply_overlay_check()
1526 return -EINVAL; in of_unittest_apply_overlay_check()
1544 !before ? "enabled" : "disabled"); in of_unittest_apply_revert_overlay_check()
1545 return -EINVAL; in of_unittest_apply_revert_overlay_check()
1561 !after ? "enabled" : "disabled"); in of_unittest_apply_revert_overlay_check()
1562 return -EINVAL; in of_unittest_apply_revert_overlay_check()
1578 !before ? "enabled" : "disabled"); in of_unittest_apply_revert_overlay_check()
1579 return -EINVAL; in of_unittest_apply_revert_overlay_check()
1661 !before ? "enabled" : "disabled"); in of_unittest_overlay_6()
1688 !after ? "enabled" : "disabled"); in of_unittest_overlay_6()
1693 for (i = 1; i >= 0; i--) { in of_unittest_overlay_6()
1713 !before ? "enabled" : "disabled"); in of_unittest_overlay_6()
1755 for (i = 1; i >= 0; i--) { in of_unittest_overlay_8()
1782 child_path = kasprintf(GFP_KERNEL, "%s/test-unittest101", in of_unittest_overlay_10()
1833 struct device *dev = &pdev->dev; in unittest_i2c_bus_probe()
1834 struct device_node *np = dev->of_node; in unittest_i2c_bus_probe()
1841 return -EINVAL; in unittest_i2c_bus_probe()
1850 return -ENOMEM; in unittest_i2c_bus_probe()
1854 std->pdev = pdev; in unittest_i2c_bus_probe()
1857 adap = &std->adap; in unittest_i2c_bus_probe()
1859 adap->nr = -1; in unittest_i2c_bus_probe()
1860 strlcpy(adap->name, pdev->name, sizeof(adap->name)); in unittest_i2c_bus_probe()
1861 adap->class = I2C_CLASS_DEPRECATED; in unittest_i2c_bus_probe()
1862 adap->algo = &unittest_i2c_algo; in unittest_i2c_bus_probe()
1863 adap->dev.parent = dev; in unittest_i2c_bus_probe()
1864 adap->dev.of_node = dev->of_node; in unittest_i2c_bus_probe()
1865 adap->timeout = 5 * HZ; in unittest_i2c_bus_probe()
1866 adap->retries = 3; in unittest_i2c_bus_probe()
1879 struct device *dev = &pdev->dev; in unittest_i2c_bus_remove()
1880 struct device_node *np = dev->of_node; in unittest_i2c_bus_remove()
1884 i2c_del_adapter(&std->adap); in unittest_i2c_bus_remove()
1890 { .compatible = "unittest-i2c-bus", },
1898 .name = "unittest-i2c-bus",
1906 struct device *dev = &client->dev; in unittest_i2c_dev_probe()
1907 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_probe()
1911 return -EINVAL; in unittest_i2c_dev_probe()
1921 struct device *dev = &client->dev; in unittest_i2c_dev_remove()
1922 struct device_node *np = client->dev.of_node; in unittest_i2c_dev_remove()
1929 { .name = "unittest-i2c-dev" },
1935 .name = "unittest-i2c-dev",
1953 struct device *dev = &client->dev; in unittest_i2c_mux_probe()
1954 struct i2c_adapter *adap = to_i2c_adapter(dev->parent); in unittest_i2c_mux_probe()
1955 struct device_node *np = client->dev.of_node, *child; in unittest_i2c_mux_probe()
1963 return -EINVAL; in unittest_i2c_mux_probe()
1966 max_reg = (u32)-1; in unittest_i2c_mux_probe()
1970 if (max_reg == (u32)-1 || reg > max_reg) in unittest_i2c_mux_probe()
1973 nchans = max_reg == (u32)-1 ? 0 : max_reg + 1; in unittest_i2c_mux_probe()
1976 return -EINVAL; in unittest_i2c_mux_probe()
1982 return -ENOMEM; in unittest_i2c_mux_probe()
1987 return -ENODEV; in unittest_i2c_mux_probe()
1998 struct device *dev = &client->dev; in unittest_i2c_mux_remove()
1999 struct device_node *np = client->dev.of_node; in unittest_i2c_mux_remove()
2008 { .name = "unittest-i2c-mux" },
2014 .name = "unittest-i2c-mux",
2211 /* order of entries is hard-coded into users of overlays[] */
2213 OVERLAY_INFO(overlay_base, -9999),
2230 OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
2231 OVERLAY_INFO(overlay_bad_symbol, -EINVAL),
2265 if (info->expected_result != -9999) { in unittest_unflatten_overlay_base()
2270 data_size = info->dtb_end - info->dtb_begin; in unittest_unflatten_overlay_base()
2276 size = fdt_totalsize(info->dtb_begin); in unittest_unflatten_overlay_base()
2288 memcpy(new_fdt, info->dtb_begin, size); in unittest_unflatten_overlay_base()
2300 * /proc/device-tree/ contains the updated structure and values from
2313 for (k = 0, info = overlays; info && info->name; info++, k++) { in overlay_data_apply()
2314 if (!strcmp(overlay_name, info->name)) { in overlay_data_apply()
2324 size = info->dtb_end - info->dtb_begin; in overlay_data_apply()
2328 ret = of_overlay_fdt_apply(info->dtb_begin, size, &info->overlay_id); in overlay_data_apply()
2330 *overlay_id = info->overlay_id; in overlay_data_apply()
2337 if (ret != info->expected_result) in overlay_data_apply()
2339 info->expected_result, ret, overlay_name); in overlay_data_apply()
2341 return (ret == info->expected_result); in overlay_data_apply()
2384 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
2385 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2386 if (!of_node_cmp(np->name, "__local_fixups__")) { in of_unittest_overlay_high_level()
2387 *pprev = np->sibling; in of_unittest_overlay_high_level()
2390 pprev = &np->sibling; in of_unittest_overlay_high_level()
2397 pprev = &overlay_base_root->child; in of_unittest_overlay_high_level()
2398 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2399 if (!of_node_cmp(np->name, "__symbols__")) { in of_unittest_overlay_high_level()
2401 *pprev = np->sibling; in of_unittest_overlay_high_level()
2404 pprev = &np->sibling; in of_unittest_overlay_high_level()
2408 for (np = overlay_base_root->child; np; np = np->sibling) { in of_unittest_overlay_high_level()
2409 if (of_get_child_by_name(of_root, np->name)) { in of_unittest_overlay_high_level()
2411 np->name); in of_unittest_overlay_high_level()
2424 for (np = overlay_base_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2425 np->parent = of_root; in of_unittest_overlay_high_level()
2429 for (last_sibling = np = of_root->child; np; np = np->sibling) in of_unittest_overlay_high_level()
2433 last_sibling->sibling = overlay_base_root->child; in of_unittest_overlay_high_level()
2435 of_root->child = overlay_base_root->child; in of_unittest_overlay_high_level()
2447 prop->name); in of_unittest_overlay_high_level()
2451 kfree(new_prop->name); in of_unittest_overlay_high_level()
2452 kfree(new_prop->value); in of_unittest_overlay_high_level()
2454 /* "name" auto-generated by unflatten */ in of_unittest_overlay_high_level()
2455 if (!strcmp(prop->name, "name")) in of_unittest_overlay_high_level()
2458 prop->name); in of_unittest_overlay_high_level()
2463 prop->name); in of_unittest_overlay_high_level()
2507 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); in of_unittest()
2514 pr_info("start of unittest - you will see error messages\n"); in of_unittest()
2536 pr_info("end of unittest - %i passed, %i failed\n", in of_unittest()