From patchwork Wed Aug 26 12:28:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Holler X-Patchwork-Id: 7076581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4BA9BC05AC for ; Wed, 26 Aug 2015 12:32:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F01220937 for ; Wed, 26 Aug 2015 12:32:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46D772060A for ; Wed, 26 Aug 2015 12:32:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUZqQ-0008DT-R8; Wed, 26 Aug 2015 12:30:22 +0000 Received: from h1446028.stratoserver.net ([85.214.92.142] helo=mail.ahsoftware.de) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZUZqO-0006rU-Cs for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2015 12:30:21 +0000 Received: by mail.ahsoftware.de (Postfix, from userid 65534) id BCFF12C9C22E; Wed, 26 Aug 2015 14:29:58 +0200 (CEST) Received: from wandq.ahsoftware (p4FC3641D.dip0.t-ipconnect.de [79.195.100.29]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.ahsoftware.de (Postfix) with ESMTPSA id 7D5372C9C22D for ; Wed, 26 Aug 2015 14:29:55 +0200 (CEST) Received: by wandq.ahsoftware (Postfix, from userid 65534) id CDD179A5417; Wed, 26 Aug 2015 14:29:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from krabat.ahsoftware (unknown [192.168.207.2]) by wandq.ahsoftware (Postfix) with ESMTP id 7E8E09A53CD; Wed, 26 Aug 2015 12:28:55 +0000 (UTC) From: Alexander Holler To: linux-kernel@vger.kernel.org Subject: [PATCH 04/16] deps: dtc: introduce new (virtual) property no-dependencies Date: Wed, 26 Aug 2015 14:28:16 +0200 Message-Id: <1440592108-3740-5-git-send-email-holler@ahsoftware.de> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440592108-3740-1-git-send-email-holler@ahsoftware.de> References: <1440592108-3740-1-git-send-email-holler@ahsoftware.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150826_053020_829893_0069C532 X-CRM114-Status: GOOD ( 15.93 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Russel King , Tomeu Vizoso , Greg KH , Grant Likely , Alexander Holler , Andrew Morton , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In some cases it makes sense to handle some phandles not as dependencies. This is escpecially true for 'remote-endpoint' properties, because these otherwise introducing dependency cycles into the graph. To avoid these, one end of each remote-endpoint pairs has not to be handled as a dependency. The syntax is like foo { remote-endpoint = <&bar>; }; bar { remote-endpoint = <&foo>; no-dependencies = <&foo>; }; Without that 'no-dependencies' property dtc would automatically add a dependency to foo to the property 'dependencies' of the node bar. But with that 'no-dependencies' it will not automatically add the listed dependencies. The property 'no-dependencies' is virtual property and will not be added to any output file. Signed-off-by: Alexander Holler --- scripts/dtc/dependencies.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/scripts/dtc/dependencies.c b/scripts/dtc/dependencies.c index 2c1e0d4..76e4d91 100644 --- a/scripts/dtc/dependencies.c +++ b/scripts/dtc/dependencies.c @@ -44,6 +44,23 @@ static bool is_parent_of(struct node *node1, struct node *node2) } +static bool is_no_dependency(struct node *dt, struct property *prop, cell_t ph) +{ + struct node *node; + unsigned i; + cell_t *cell = (cell_t *)(prop->val.val); + + for (i = 0; i < prop->val.len/4; ++i) { + node = get_node_by_phandle(dt, cpu_to_fdt32(*cell++)); + if (node) { + node = find_compatible_not_disabled(node); + if (node && get_node_phandle(dt, node) == ph) + return true; + } + } + return false; +} + static void add_deps(struct node *dt, struct node *node, struct property *prop) { struct marker *m = prop->val.markers; @@ -73,6 +90,10 @@ static void add_deps(struct node *dt, struct node *node, struct property *prop) is_parent_of(target, source)) continue; phandle = get_node_phandle(dt, target); + prop_deps = get_property(node, "no-dependencies"); + if (prop_deps && is_no_dependency(dt, prop_deps, phandle)) + /* avoid adding non-dependencies */ + continue; prop_deps = get_property(source, "dependencies"); if (!prop_deps) { add_property(source, @@ -102,9 +123,21 @@ static void process_nodes_props(struct node *dt, struct node *node) process_nodes_props(dt, child); } +static void del_prop_no_dependencies(struct node *node) +{ + struct node *child; + + if (!node) + return; + delete_property_by_name(node, "no-dependencies"); + for_each_child(node, child) + del_prop_no_dependencies(child); +} + void add_dependencies(struct boot_info *bi) { process_nodes_props(bi->dt, bi->dt); + del_prop_no_dependencies(bi->dt); } /*