From patchwork Thu Jun 22 07:54:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 106187 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2331757qgd; Thu, 22 Jun 2017 00:56:42 -0700 (PDT) X-Received: by 10.80.137.36 with SMTP id e33mr1586501ede.67.1498118202127; Thu, 22 Jun 2017 00:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498118202; cv=none; d=google.com; s=arc-20160816; b=N+ureJVIRzrXHChUbhExiegxMT1EhlaLqbbzBkHRW5i7HJ+wpUns1wWtaQ6sfR4xAU Jvqnmq1cimfbUHcFyMzzrMPN6APMLAeAuskfMAYonsN9Gjqav4/O+YwD06iVSRi+Naq9 vjjchyQ9KaKsJ6qPoOqJM+U0HLPxfv/TcRYtNd1twfJRTeS9HqPkkYjaWmuFNaPB9vLo fGxAn84lQb/+sEgoaI24y0uRR4fij2qk9PO0pmOaTuM9Mb2JlXt0jOVLuZB6JnUENBIM BDdhOL5J/O18Abo/Xczp1EiHtqj8iChrkw9Gcp6CDLBDoMUsYCTcpqZoUkVnR1fkw8Mn P1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=iY0I//MBBGxTYEmOIxJ3ovAxIWC8Qn/z/KJU5rJM9dY=; b=R9AqEkd6O/9IvVkJCL2ELD6Yqduu4UOmYwNEBkMfbft3nFTCWDMUbN7jGa5qmGLxwf 3ZvPwxJIxeHIE7za097DXKZF34qqtpgRFQPmIdZ+vWjv8390mghhy6PsFhP/Rm913snQ 2bUx9ArlrlFjrUftHLTjwB1ayBEZg05G0IJDZx4zlUwr9/VlOWtdoUEcdKWI0w1Jek/4 PdD6O8oxb/MDyJVh6uVURqPGuoQWNQSDnbi9o7/TylqcOgWNOU0tWDqIwU/sPjAGewBJ 2jx1qVCrVua+rr69pG/M0q2BLIai8vVbdwiefvJuG5dIB4CZWTccoMtPfB5E3xSRIGqu rzAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=pQowAjtR; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id f25si95541edc.261.2017.06.22.00.56.41; Thu, 22 Jun 2017 00:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=pQowAjtR; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 9CC82C21CCD; Thu, 22 Jun 2017 07:55:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4E7EBC21C9D; Thu, 22 Jun 2017 07:54:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 463EAC21C3E; Thu, 22 Jun 2017 07:54:34 +0000 (UTC) Received: from conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by lists.denx.de (Postfix) with ESMTPS id 331C9C21C55 for ; Thu, 22 Jun 2017 07:54:32 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id v5M7s9k9009287; Thu, 22 Jun 2017 16:54:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v5M7s9k9009287 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1498118052; bh=N280b5mDGoIkUPOn2PU0e++aQhgVYp1x3MGVFb92pio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQowAjtRn7RpwwEx2lsh5wK/pma+QY+goy9+4TnNFYQ8Ds2BYh7ONUMlYuuV7tz/s TKXuL3JY1XBT+5K0A0dMvK2cGho3x5gT/9fdEkwdRvVzs0pEJD6pgIetrXe6o4itXS brd9Y59FJOk1ZX2Bv7U1oOQpysM+mFeVyibGa/g0ZgDcgqm9mLN/CTkgQNzMa7TCJF p8GbtZ5dAk7DDbExfs9bkzhMRJbGzqIM3VrDBSOsdlyhLPiNQHuO0M3FwUhKFNPc6q 6JziHxZVjutauZZN40FtyHMMzn15JdHPbuAQN6+vz5phQuc9cfNNMCHZEzEIOiuNWP x2AzLHNAgvxjw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 22 Jun 2017 16:54:07 +0900 Message-Id: <1498118047-11918-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498118047-11918-1-git-send-email-yamada.masahiro@socionext.com> References: <1498118047-11918-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 5/5] dm: ofnode: simplify ofnode_read_bool() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Reuse ofnode_get_property() to simplify the implementation. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass 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 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)