diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-06-22 16:54:07 +0900 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-07-11 10:08:20 -0600 |
commit | b2ec7ea731a1300fc3b888d9efa870fb4dafda79 (patch) | |
tree | b017e93d09d9f577658be4591c44a3d77fe71e1d /drivers/core | |
parent | 61e51babdb674e4619165cdc180786af7ec75ae9 (diff) | |
download | u-boot-b2ec7ea731a1300fc3b888d9efa870fb4dafda79.tar.gz u-boot-b2ec7ea731a1300fc3b888d9efa870fb4dafda79.tar.xz u-boot-b2ec7ea731a1300fc3b888d9efa870fb4dafda79.zip |
dm: ofnode: simplify ofnode_read_bool()
Reuse ofnode_get_property() to simplify the implementation.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/ofnode.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 372d07a0c9..be6447daa1 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) |