From patchwork Tue Aug 20 10:01:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 2846998 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5E3E29F2F4 for ; Tue, 20 Aug 2013 10:01:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FFC720201 for ; Tue, 20 Aug 2013 10:01:31 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18CDF201FD for ; Tue, 20 Aug 2013 10:01:30 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBikh-0004Rm-EL; Tue, 20 Aug 2013 10:01:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBikf-0008IU-4M; Tue, 20 Aug 2013 10:01:25 +0000 Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VBikc-0008HG-Eg for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2013 10:01:23 +0000 Received: from armhf (unknown [IPv6:2a01:e35:2f5c:9de0:212:bfff:fe1e:9ce4]) by smtp3-g21.free.fr (Postfix) with ESMTP id 61508A6225; Tue, 20 Aug 2013 12:00:46 +0200 (CEST) Date: Tue, 20 Aug 2013 12:01:05 +0200 From: Jean-Francois Moine To: Grant Likely , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] of: reduce the number of PROBE_DEFERs Message-ID: <20130820120105.55a4c0ce@armhf> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.20; arm-unknown-linux-gnueabihf) Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130820_060123_203276_4E93134A X-CRM114-Status: GOOD ( 16.52 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch populates the platform from the device tree into two steps: the first step creates the nodes that are referenced by a phandle, the second step creates the other nodes. This permits to reduce the number of PROBE_DEFERs. Signed-off-by: Jean-Francois Moine --- A better way to reduce probe deferral could be sorting the nodes according to their phandle level in the DT blob at compilation time ... --- drivers/of/platform.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index e0a6514..a2ea858 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -382,8 +382,23 @@ static int of_platform_bus_create(struct device_node *bus, if (!dev || !of_match_node(matches, bus)) return 0; + /* first step: create the nodes that are referenced by phandle */ for_each_child_of_node(bus, child) { - pr_debug(" create child: %s\n", child->full_name); + if (child->phandle == 0) + continue; + pr_debug(" create child 1: %s\n", child->full_name); + rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); + if (rc) { + of_node_put(child); + return rc; + } + } + + /* second step: create the other nodes */ + for_each_child_of_node(bus, child) { + if (child->phandle != 0) + continue; + pr_debug(" create child 2: %s\n", child->full_name); rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict); if (rc) { of_node_put(child);