aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass2020-11-28 17:50:02 -0700
committerSimon Glass2020-12-13 07:58:18 -0700
commit0de1b07406d709c3951dbb1a69ca196d80bd516d (patch)
treea741e4a124438112f6ef63c0fce2473da2870227 /test
parent734206dda14b328bfb946eea1e343f06a5fcceea (diff)
dm: core: Add a livetree function to check node status
Add a way to find out if a node is enabled or not, based on its 'status' property. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/ofnode.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index fb1ceb13180..c5391342962 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -249,3 +249,15 @@ static int dm_test_ofnode_get_child_count(struct unit_test_state *uts)
}
DM_TEST(dm_test_ofnode_get_child_count,
UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+static int dm_test_ofnode_is_enabled(struct unit_test_state *uts)
+{
+ ofnode root_node = ofnode_path("/");
+ ofnode node = ofnode_path("/usb@0");
+
+ ut_assert(ofnode_is_enabled(root_node));
+ ut_assert(!ofnode_is_enabled(node));
+
+ return 0;
+}
+DM_TEST(dm_test_ofnode_is_enabled, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);