diff options
author | Simon Glass <sjg@chromium.org> | 2022-07-30 15:52:13 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-08-12 08:14:24 -0400 |
commit | 39e42be12b9456e604ac3e228973b1cb1136864c (patch) | |
tree | 14b0f51e7ad986d730b39d8b0bf0440ddf1b5659 /test | |
parent | 7b1dfc9fd7e2efed345c3fe9a2412b5300ac285e (diff) | |
download | u-boot-39e42be12b9456e604ac3e228973b1cb1136864c.tar.gz u-boot-39e42be12b9456e604ac3e228973b1cb1136864c.tar.bz2 u-boot-39e42be12b9456e604ac3e228973b1cb1136864c.zip |
dm: core: Allow writing to a flat tree with ofnode
In generally it is not permitted to implement an ofnode function only for
flat tree or live tree. Both must be supported. Also the code for
live tree access should be in of_access.c rather than ofnode.c which is
really just for holding the API-conversion code.
Update ofnode_write_prop() accordingly and fix the test so it can work
with flat tree too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/ofnode.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index ce96f9d1ee..bd598d23e4 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -549,9 +549,9 @@ static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts) /* Test enabling devices */ node = ofnode_path("/usb@2"); - ut_assert(!of_device_is_available(ofnode_to_np(node))); - ofnode_set_enabled(node, true); - ut_assert(of_device_is_available(ofnode_to_np(node))); + ut_assert(!ofnode_is_enabled(node)); + ut_assertok(ofnode_set_enabled(node, true)); + ut_asserteq(true, ofnode_is_enabled(node)); device_bind_driver_to_node(dm_root(), "usb_sandbox", "usb@2", node, &dev); @@ -577,11 +577,11 @@ static int dm_test_ofnode_livetree_writing(struct unit_test_state *uts) device_remove(dev, DM_REMOVE_NORMAL); device_unbind(dev); - ut_assert(of_device_is_available(ofnode_to_np(node))); - ofnode_set_enabled(node, false); - ut_assert(!of_device_is_available(ofnode_to_np(node))); + ut_assert(ofnode_is_enabled(node)); + ut_assertok(ofnode_set_enabled(node, false)); + ut_assert(!ofnode_is_enabled(node)); return 0; } DM_TEST(dm_test_ofnode_livetree_writing, - UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_LIVE_TREE); + UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_LIVE_OR_FLAT); |