diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-03-26 11:50:33 +0000 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2020-04-29 10:19:17 +0100 |
commit | be858cffa91fbcd5b8657200fbec1667c65bb1b7 (patch) | |
tree | ca4dd52e59cab7f304e296a122f6346315a8008d /common/fdt_wrappers.c | |
parent | ff4e6c35c9f3f0b1d190b5d3761a13d701af6925 (diff) | |
download | trusted-firmware-a-be858cffa91fbcd5b8657200fbec1667c65bb1b7.tar.gz |
plat/stm32: Implement fdt_read_uint32_default() as a wrapper
The STM32 platform code uses its own set of FDT helper functions,
although some of them are fairly generic.
Remove the implementation of fdt_read_uint32_default() and implement it
on top of the newly introduced fdt_read_uint32() function, then convert
all users over.
This also fixes two callers, which were slightly abusing the "default"
semantic.
Change-Id: I570533362b4846e58dd797a92347de3e0e5abb75
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'common/fdt_wrappers.c')
-rw-r--r-- | common/fdt_wrappers.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/common/fdt_wrappers.c b/common/fdt_wrappers.c index 394f3b0ca0..57e3bcd406 100644 --- a/common/fdt_wrappers.c +++ b/common/fdt_wrappers.c @@ -56,6 +56,19 @@ int fdt_read_uint32(const void *dtb, int node, const char *prop_name, return fdt_read_uint32_array(dtb, node, prop_name, 1, value); } +uint32_t fdt_read_uint32_default(const void *dtb, int node, + const char *prop_name, uint32_t dflt_value) +{ + uint32_t ret = dflt_value; + int err = fdt_read_uint32(dtb, node, prop_name, &ret); + + if (err < 0) { + return dflt_value; + } + + return ret; +} + int fdt_read_uint64(const void *dtb, int node, const char *prop_name, uint64_t *value) { |