From patchwork Thu Jun 22 07:54:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 106188 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2331959qgd; Thu, 22 Jun 2017 00:57:20 -0700 (PDT) X-Received: by 10.80.170.115 with SMTP id p48mr1626805edc.33.1498118239960; Thu, 22 Jun 2017 00:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498118239; cv=none; d=google.com; s=arc-20160816; b=CTPiTIny8l3V9/30hz65MegCgbnfSWVOvZi/yWA+gR8f2d0Tri7M+0aVCvStxd7YCW rp6C+cO14V40GxtZYlTNz8yKzasfQVO8s+XPD2bqlfZnNhh0Hb8zOlV1B6+XyH4MMddh D7nIM0qp1tpFQtexOg9nRy5aS//I89I/51tEGimbNpgbRn5+PAJtwEkK0eUg6hY65+IM ZSB9MXHSXPsdxX9i1Xxk4NoRZgXPQu5MC3sEfHgUeApNXikDHqqsj5TUBM4PjL9mIru3 EToo9irf3g4qBqE8vtfJDUAz0zj0WdropGxKNSuXa8ZFnmlrhQ0ZswMw79k1cwV0s2L0 X4ow== 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:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=VZ3IkQbygRTwyYroCq9yMH6l+56rDZQ2eBK3vrwxlqk=; b=RCgs9OWlakUmVaH42W1K9hGeLQ2d/euKmLXURjY0RWp4ykGXrBmbil+hLcBAEaBIeW J0ycb86vFU5sbDfXl8KQojPY+7TurA2y9cQyHwLCzsgzdUvPhFhQ0B3/FcYgeO3/c/JU CpvVeC0x6PyvP4HArqm3X7ueY1rvJDLlyD508qxn+MGhRMY7PexndnzO1LFJppyDgLDC Zb3OvwCNyS2F8vbJ6yriECpCVpkPYedsInbovPQF6dEO0pdzrFb/YIY9LChQq8Mpu6mr RQVRCS8Kjx9n17FTPz59Vt4aiCDSNjx/8b/5s6JsRWCJUl6JDTwOQiuQWkB7tBy6f5zW 56Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=Kc9rvT3G; 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 5si1120656edp.345.2017.06.22.00.57.19; Thu, 22 Jun 2017 00:57:19 -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=Kc9rvT3G; 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 73D81C21C65; Thu, 22 Jun 2017 07:56:21 +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 F3F16C21CAA; Thu, 22 Jun 2017 07:56:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9BAF6C21CAD; Thu, 22 Jun 2017 07:55:04 +0000 (UTC) Received: from conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by lists.denx.de (Postfix) with ESMTPS id 27212C21C91 for ; Thu, 22 Jun 2017 07:55:00 +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 v5M7s9k7009287; Thu, 22 Jun 2017 16:54:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v5M7s9k7009287 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1498118051; bh=uOSMdZ++EKEgek2uNtKReyXfZiKEwpK6qdqH6dCiHZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kc9rvT3GWheHwi43PmsLaHwzgPEECDi3JV9PSLgs1ezjq4G4oQq/LvTHwRACobMEQ 2Ax7Qhq/TmornyRCt0wNGns+bx2BuKAv+FyyI/RrbYisOtPEV68YdWS7M80pyIRXo+ Q5JzSAgXK5LxENAom4aY/HfCMig262dpIkTZee/UsYeY9R+O7YNoqibK5at+jScjtJ HwUKdaavjJF/vvYjwjScISFGSee+jnSb+kRnaDaOC0qTKOExPOax8FbAplykyCW3Yb ubmOiM39CKPzwBSCrjudc6hUGuxQCSrq87akZqtzB3iGdY12x4jHNDscWNSDkKTeMk pKRGvgvJlbv+A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 22 Jun 2017 16:54:05 +0900 Message-Id: <1498118047-11918-3-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> Cc: "xypron.glpk@gmx.de" , Hou Zhiqiang Subject: [U-Boot] [PATCH 3/5] dm: ofnode: rename ofnode_read_prop() to ofnode_get_property() 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" This function returns the pointer to the value of a node property. The current name ofnode_read_prop() is confusing. Follow the naming of_get_property() from Linux. The return type (const u32 *) is wrong. DT property values can be strings as well as integers. This is why of_get_property/fdt_getprop returns an opaque pointer. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass Acked-by: Simon Glass --- drivers/core/lists.c | 3 +-- drivers/core/ofnode.c | 4 ++-- drivers/core/read.c | 2 +- drivers/misc/cros_ec_sandbox.c | 2 +- drivers/pci/pci-uclass.c | 2 +- drivers/pinctrl/pinctrl-uclass.c | 2 +- include/dm/ofnode.h | 4 ++-- include/dm/read.h | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/core/lists.c b/drivers/core/lists.c index b79f26dbe6c9..6067914e8117 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -141,8 +141,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp) name = ofnode_get_name(node); dm_dbg("bind node %s\n", name); - compat_list = (const char *)ofnode_read_prop(node, "compatible", - &compat_length); + compat_list = ofnode_get_property(node, "compatible", &compat_length); if (!compat_list) { if (compat_length == -FDT_ERR_NOTFOUND) { dm_dbg("Device '%s' has no compatible string\n", name); diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 08b3e03b1e8e..87e731dc2b77 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -422,7 +422,7 @@ int ofnode_decode_display_timing(ofnode parent, int index, return ret; } -const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp) +const void *ofnode_get_property(ofnode node, const char *propname, int *lenp) { if (ofnode_is_np(node)) return of_get_property(ofnode_to_np(node), propname, lenp); @@ -493,7 +493,7 @@ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, * #size-cells. They need to be 3 and 2 accordingly. However, * for simplicity we skip the check here. */ - cell = ofnode_read_prop(node, propname, &len); + cell = ofnode_get_property(node, propname, &len); if (!cell) goto fail; diff --git a/drivers/core/read.c b/drivers/core/read.c index 3131e5379c96..c1fe949808fa 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -106,7 +106,7 @@ int dev_read_phandle(struct udevice *dev) const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp) { - return ofnode_read_prop(dev_ofnode(dev), propname, lenp); + return ofnode_get_property(dev_ofnode(dev), propname, lenp); } int dev_read_alias_seq(struct udevice *dev, int *devnump) diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index c96e26e6b782..5924adee4085 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -197,7 +197,7 @@ static int keyscan_read_fdt_matrix(struct ec_state *ec, ofnode node) int upto; int len; - cell = ofnode_read_prop(node, "linux,keymap", &len); + cell = ofnode_get_property(node, "linux,keymap", &len); ec->matrix_count = len / 4; ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix)); if (!ec->matrix) { diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index b36ef3338ceb..922401f2a015 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -763,7 +763,7 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, int len; int i; - prop = ofnode_read_prop(node, "ranges", &len); + prop = ofnode_get_property(node, "ranges", &len); if (!prop) return -EINVAL; pci_addr_cells = ofnode_read_addr_cells(node); diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index 02e269020df5..114952a1da36 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -134,7 +134,7 @@ static int pinconfig_post_bind(struct udevice *dev) * If this node has "compatible" property, this is not * a pin configuration node, but a normal device. skip. */ - ofnode_read_prop(node, "compatible", &ret); + ofnode_get_property(node, "compatible", &ret); if (ret >= 0) continue; diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 149622a0b2c9..1c507c9f1688 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -463,14 +463,14 @@ int ofnode_decode_display_timing(ofnode node, int index, struct display_timing *config); /** - * ofnode_read_prop()- - read a node property + * ofnode_get_property()- - get a pointer to the value of a node property * * @node: node to read * @propname: property to read * @lenp: place to put length on success * @return pointer to property, or NULL if not found */ -const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp); +const void *ofnode_get_property(ofnode node, const char *propname, int *lenp); /** * ofnode_is_available() - check if a node is marked available diff --git a/include/dm/read.h b/include/dm/read.h index 8c9846eaf26f..562881962a64 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -389,7 +389,7 @@ static inline int dev_read_phandle(struct udevice *dev) static inline const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp) { - return ofnode_read_prop(dev_ofnode(dev), propname, lenp); + return ofnode_get_property(dev_ofnode(dev), propname, lenp); } static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)