summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-09-07 05:27:21 +0300
committerTom Rini <trini@konsulko.com>2022-09-30 05:43:43 +0300
commit085d59411ca7cde4ca5c70beeab4fdcea209aed6 (patch)
tree2d5b1b974b7230c21a605394279657b14147ab39 /test
parenta3f50d038695887808497c1a15c9fcc122d964e6 (diff)
downloadu-boot-085d59411ca7cde4ca5c70beeab4fdcea209aed6.tar.xz
dm: core: Add ofnode functions to obtain an oftree
At present dm_test_ofnode_root() does this manually. Add some inline functions to handle it, so this code can be centralised. Add oftree functions to produce a null tree and to check whether a tree is valid or not. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/ofnode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index eac0c50364..f146b52d62 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -518,13 +518,16 @@ static int dm_test_ofnode_root(struct unit_test_state *uts)
ut_assert(ofnode_valid(node));
ut_asserteq_str("sbe5", ofnode_get_name(node));
+ ut_assert(!oftree_valid(oftree_null()));
+
ut_assertok(make_ofnode_fdt(uts, fdt, sizeof(fdt)));
if (of_live_active()) {
ut_assertok(unflatten_device_tree(fdt, &root));
- tree.np = root;
+ tree = oftree_from_np(root);
} else {
- tree.fdt = fdt;
+ tree = oftree_from_fdt(fdt);
}
+ ut_assert(oftree_valid(tree));
/* Make sure they don't work on this new tree */
node = ofnode_path_root(tree, "mmc0");