[U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool()
Masahiro Yamada
yamada.masahiro at socionext.com
Thu Jun 22 07:54:07 UTC 2017
Reuse ofnode_get_property() to simplify the implementation.
Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---
drivers/core/ofnode.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 87e731dc2b77..5a3e1d452fbb 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -57,20 +57,16 @@ int ofnode_read_s32_default(ofnode node, const char *propname, s32 def)
bool ofnode_read_bool(ofnode node, const char *propname)
{
- bool val;
+ const void *prop;
assert(ofnode_valid(node));
debug("%s: %s: ", __func__, propname);
- if (ofnode_is_np(node)) {
- val = !!of_find_property(ofnode_to_np(node), propname, NULL);
- } else {
- val = !!fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
- propname, NULL);
- }
- debug("%s\n", val ? "true" : "false");
+ prop = ofnode_get_property(node, propname, NULL);
+
+ debug("%s\n", prop ? "true" : "false");
- return val;
+ return prop ? true : false;
}
const char *ofnode_read_string(ofnode node, const char *propname)
--
2.7.4
More information about the U-Boot
mailing list