From b2ec7ea731a1300fc3b888d9efa870fb4dafda79 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 22 Jun 2017 16:54:07 +0900 Subject: [PATCH] dm: ofnode: simplify ofnode_read_bool() Reuse ofnode_get_property() to simplify the implementation. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- 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 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) -- 2.39.5