diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-12-30 02:00:05 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2018-01-22 14:11:58 +0900 |
commit | 3ab48f62230b6753bf5535655c40e3b975825bd9 (patch) | |
tree | 25dcc283624d0cf8ecc1f44ba789f83fbbffd7e1 /drivers/core | |
parent | 557767ed29968af0294e3aae48433e5d5a298e0b (diff) | |
download | u-boot-3ab48f62230b6753bf5535655c40e3b975825bd9.tar.gz u-boot-3ab48f62230b6753bf5535655c40e3b975825bd9.tar.xz u-boot-3ab48f62230b6753bf5535655c40e3b975825bd9.zip |
dm: add dev_read_u32()
dev_read_u32_default() always returns something even when the property
is missing. So, it is impossible to do nothing in the case. One
solution is to use ofnode_read_u32() instead, but adding dev_read_u32()
will be helpful.
BTW, Linux has an equvalent function, device_property_read_u32();
it is clearer that it reads a property. I cannot understand the
behavior of dev_read_u32() from its name.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/read.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/core/read.c b/drivers/core/read.c index f346cc1eb6..758d4003e5 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -10,6 +10,11 @@ #include <mapmem.h> #include <dm/of_access.h> +int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp) +{ + return ofnode_read_u32(dev_ofnode(dev), propname, outp); +} + int dev_read_u32_default(struct udevice *dev, const char *propname, int def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); |