From patchwork Thu Mar 26 10:09:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kever Yang X-Patchwork-Id: 1261921 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Ott4bPO6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48p1314kGJz9sRN for ; Thu, 26 Mar 2020 21:10:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5874081885; Thu, 26 Mar 2020 11:10:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Ott4bPO6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A15081860; Thu, 26 Mar 2020 11:09:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 08E218183D for ; Thu, 26 Mar 2020 11:09:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=rock-chips.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kever.yang@gmail.com Received: by mail-pl1-x642.google.com with SMTP id t16so1938902plr.8 for ; Thu, 26 Mar 2020 03:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=uSfWhOdDSQylbTHKiE9xIbXCGbOHKieO4M+RjwqgoCs=; b=Ott4bPO6M3KM9L2zDZ3ayYUYzTqJKw1BFa7XC6H0gTAfBrf72/vSTftfRdy1uwmeiZ Yq2j6KF9or9IHbyadYN2tPM4He7x4HgCuBNqupPmLM4gORbkGvt3BfozpDz2HEtl2r+f b20I1xK8E2nDgBjSOiRPa4DJRF985WP3LN9yPLW5wMNkARRnqG0pP0SKHAypLszhijkL GCWESWltZxtHU9Ol5QVDEOx/0Ql8RpjK6zgO651FFdUoWaHc9CrR5oK5CeKmDgSpHvlA tlWoLVTFQX3zySoGWnHESIpUYi+t6UjZbB04m0kgr6PMFdrjyJCvwl7TmYRWMiYMHxm3 +eJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=uSfWhOdDSQylbTHKiE9xIbXCGbOHKieO4M+RjwqgoCs=; b=r2ryBH3tOEsqh01lm8iGM/Z7ttO0o3j99Fn68bqD1xsfyBXsa9n7lXLP2J0gOn9Q3a BWn6j9Vj2ng18XA/WiPMe3XQ2dQ8T3oyM36PNUow017z1pdHYIspW5omVUzTo6OCZV3g k6miAk9RtYg5ZoX+P4SOZ0kUoLGUTE3S9bI9eN0LeIGP89zvXAOXH3+gkIUJucgTeA0e nfm8mc+Lx8FwD/Dc5keLZue/CVHcDTfmi8gT1APIHOQdC+nJ/+eD7zRu7o4lAcydXpkf TfmnPkwxsFaQ/YdsYYjNB4mNCegWLUsGLPsSDgpnElRIB7Q517bh+2OoO7GsaIi6P78d uFYw== X-Gm-Message-State: ANhLgQ3uHq3ug++Hh5He1h/5Y6a917Zbi754VsoWgdBAU9U5aULnsTok w79P7Sc1dl8goF6Ddi2+Kd9rwivH X-Google-Smtp-Source: ADFU+vuNLExvmaO9OVT0+rpMZd0pYOZ6s4FgJSr2Gu5Oh4RHQWp0Z70GA0j6AnnUWKjnXiNJXbQ/Lw== X-Received: by 2002:a17:902:123:: with SMTP id 32mr7593698plb.38.1585217378096; Thu, 26 Mar 2020 03:09:38 -0700 (PDT) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id a26sm1308240pgn.14.2020.03.26.03.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 03:09:37 -0700 (PDT) From: Kever Yang To: u-boot@lists.denx.de Cc: punit1.agrawal@toshiba.co.jp, rasmus.villemoes@prevas.dk, xypron.glpk@gmx.de, chenjh@rock-chips.com, trini@konsulko.com, Kever Yang , Simon Glass Subject: [PATCH v3 7/8] libfdt: Make fdtdec_get_child_count() available for HOST Date: Thu, 26 Mar 2020 18:09:15 +0800 Message-Id: <20200326100916.22532-7-kever.yang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200326100916.22532-1-kever.yang@rock-chips.com> References: <20200326100916.22532-1-kever.yang@rock-chips.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean The tool need to use fdtdec_get_child_count(), make it available for HOST_CC. Signed-off-by: Kever Yang --- Changes in v3: None Changes in v2: None include/fdt_support.h | 1 + lib/fdtdec.c | 11 ----------- lib/fdtdec_common.c | 11 +++++++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/fdt_support.h b/include/fdt_support.h index 3f4bc643d4..9b88fd1723 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -329,6 +329,7 @@ int fdt_get_cells_len(const void *blob, char *nr_cells_name); #ifdef USE_HOSTCC int fdtdec_get_int(const void *blob, int node, const char *prop_name, int default_val); +int fdtdec_get_child_count(const void *blob, int node); #endif #ifdef CONFIG_FMAN_ENET int fdt_update_ethernet_dt(void *blob); diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 61af3472e6..c55c77a31c 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -807,17 +807,6 @@ int fdtdec_parse_phandle_with_args(const void *blob, int src_node, return rc; } -int fdtdec_get_child_count(const void *blob, int node) -{ - int subnode; - int num = 0; - - fdt_for_each_subnode(subnode, blob, node) - num++; - - return num; -} - int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name, u8 *array, int count) { diff --git a/lib/fdtdec_common.c b/lib/fdtdec_common.c index 088e9e9063..5775992ef3 100644 --- a/lib/fdtdec_common.c +++ b/lib/fdtdec_common.c @@ -53,3 +53,14 @@ unsigned int fdtdec_get_uint(const void *blob, int node, const char *prop_name, debug("(not found)\n"); return default_val; } + +int fdtdec_get_child_count(const void *blob, int node) +{ + int subnode; + int num = 0; + + fdt_for_each_subnode(subnode, blob, node) + num++; + + return num; +}