From: Masahiro Yamada Date: Thu, 22 Jun 2017 07:54:07 +0000 (+0900) Subject: dm: ofnode: simplify ofnode_read_bool() X-Git-Tag: v2017.09-rc1~214^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b2ec7ea731a1300fc3b888d9efa870fb4dafda79;p=u-boot dm: ofnode: simplify ofnode_read_bool() Reuse ofnode_get_property() to simplify the implementation. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- 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)