diff options
author | Simon Glass <sjg@chromium.org> | 2023-09-26 08:14:45 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-06 14:38:13 -0400 |
commit | 7071c82bdc55ed5d7955d8e1682b7c80af5659b5 (patch) | |
tree | 24e8c3bd7ca4fe80759f30dd3ea37b8af512bee4 /test/dm | |
parent | d9216c8683fced4cbf6d437b4357c9368bf1bf86 (diff) | |
download | u-boot-7071c82bdc55ed5d7955d8e1682b7c80af5659b5.zip u-boot-7071c82bdc55ed5d7955d8e1682b7c80af5659b5.tar.gz u-boot-7071c82bdc55ed5d7955d8e1682b7c80af5659b5.tar.bz2 |
dm: core: Support writing a 64-bit value
Add support for writing a single 64-bit value into a property.
Repurpose the existing tests to handle this case too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/ofnode.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 9477f79..e078a97 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -1009,7 +1009,8 @@ static int dm_test_ofnode_u32_array(struct unit_test_state *uts) } DM_TEST(dm_test_ofnode_u32_array, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -static int dm_test_ofnode_read_u64(struct unit_test_state *uts) +/* test ofnode_read_u64() and ofnode_write_u64() */ +static int dm_test_ofnode_u64(struct unit_test_state *uts) { ofnode node; u64 val; @@ -1018,6 +1019,10 @@ static int dm_test_ofnode_read_u64(struct unit_test_state *uts) ut_assert(ofnode_valid(node)); ut_assertok(ofnode_read_u64(node, "int64-value", &val)); ut_asserteq_64(0x1111222233334444, val); + ut_assertok(ofnode_write_u64(node, "new-int64-value", 0x9876543210)); + ut_assertok(ofnode_read_u64(node, "new-int64-value", &val)); + ut_asserteq_64(0x9876543210, val); + ut_asserteq(-EINVAL, ofnode_read_u64(node, "missing", &val)); ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val)); @@ -1028,9 +1033,15 @@ static int dm_test_ofnode_read_u64(struct unit_test_state *uts) ofnode_read_u64_index(node, "int64-array", 2, &val)); ut_asserteq(-EINVAL, ofnode_read_u64_index(node, "missing", 0, &val)); + ut_assertok(ofnode_write_u64(node, "int64-array", 0x9876543210)); + ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val)); + ut_asserteq_64(0x9876543210, val); + ut_asserteq(-EOVERFLOW, + ofnode_read_u64_index(node, "int64-array", 1, &val)); + return 0; } -DM_TEST(dm_test_ofnode_read_u64, UT_TESTF_SCAN_FDT); +DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT); static int dm_test_ofnode_add_subnode(struct unit_test_state *uts) { |