summaryrefslogtreecommitdiff
path: root/test/dm/ofnode.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2023-08-25 11:37:46 +0200
committerMichal Simek <michal.simek@amd.com>2023-09-21 13:20:10 +0200
commitfa12dfa08a7bdc7d67e3758f10461468a663ce2e (patch)
tree6639f242e26867cb59b662da81680240e35b5784 /test/dm/ofnode.c
parent91ed45a24f5bad1d8538a8f54738e51924443b76 (diff)
dm: core: support reading a single indexed u64 value
Add helper function to allow reading a single indexed u64 value from a device-tree property containing multiple u64 values, that is an array of u64's. Co-developed-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/08043c8d204d0068f04c27de86afe78c75c50b69.1692956263.git.michal.simek@amd.com
Diffstat (limited to 'test/dm/ofnode.c')
-rw-r--r--test/dm/ofnode.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 6fbebc7da08..b74f5c2ebcf 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -967,6 +967,14 @@ static int dm_test_ofnode_u64(struct unit_test_state *uts)
ut_asserteq_64(0x1111222233334444, val);
ut_asserteq(-EINVAL, ofnode_read_u64(node, "missing", &val));
+ ut_assertok(ofnode_read_u64_index(node, "int64-array", 0, &val));
+ ut_asserteq_64(0x1111222233334444, val);
+ ut_assertok(ofnode_read_u64_index(node, "int64-array", 1, &val));
+ ut_asserteq_64(0x4444333322221111, val);
+ ut_asserteq(-EOVERFLOW,
+ ofnode_read_u64_index(node, "int64-array", 2, &val));
+ ut_asserteq(-EINVAL, ofnode_read_u64_index(node, "missing", 0, &val));
+
return 0;
}
DM_TEST(dm_test_ofnode_u64, UT_TESTF_SCAN_FDT);