From patchwork Mon Sep 21 14:03:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 7231831 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 118FF9F32B for ; Mon, 21 Sep 2015 14:16:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 56A4F206FD for ; Mon, 21 Sep 2015 14:16:31 +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 64B7C206FB for ; Mon, 21 Sep 2015 14:16:30 +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 1Ze1sF-0002bM-Ob; Mon, 21 Sep 2015 14:15:19 +0000 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ze1hr-0002I0-Og for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2015 14:04:37 +0000 Received: by wicge5 with SMTP id ge5so117485640wic.0 for ; Mon, 21 Sep 2015 07:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=BUI/eH6vWI5xCKoILzjETvH0WD1SM7obWSYuSj2hgnI=; b=I4a2y2IdmPvIDEiOJKsCsTCgZ3bC6XRQsTO+HGS0qv3MUG7mK2rn9RYXQBCINA+pGv Vh7/COCXOi18zUpkacNHd8ncVQFHTXNUN/qy46vcAZDUMXT2kcX1QB59OVeOgPS6bT44 c7X709Q02i88lvRgV3GZbvT+NXUo80Ljlyfz5G2Lr3imCqN7hyuUMOj4WPTpouRIMS1g w1Eh5n9NJL3IOWfrIzQXTE27qDj8Q+xdv66HUr9QlHFig8OLa4NL+AP+xq8sURJskzBl ahUHYl1i36vHkwz4WVvRr+WAK7CC/11/VlePffU+70ZxE47ZT69MrU+pHK/Z/U4GAvfE vkdw== X-Received: by 10.180.184.134 with SMTP id eu6mr14506516wic.77.1442844254072; Mon, 21 Sep 2015 07:04:14 -0700 (PDT) Received: from cizrna.lan ([109.72.12.69]) by smtp.gmail.com with ESMTPSA id gk9sm13687031wib.9.2015.09.21.07.04.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2015 07:04:13 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [PATCH v6 22/22] of/platform: Defer probes of registered devices Date: Mon, 21 Sep 2015 16:03:02 +0200 Message-Id: <1442844182-27787-23-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1442844182-27787-1-git-send-email-tomeu.vizoso@collabora.com> References: <1442844182-27787-1-git-send-email-tomeu.vizoso@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150921_070436_096278_03934499 X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -2.6 (--) 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: Tomeu Vizoso , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, Arnd Bergmann , Stephen Warren , Greg Kroah-Hartman , Linus Walleij , Dmitry Torokhov , "Rafael J. Wysocki" , Rob Herring , Javier Martinez Canillas , Mark Brown , Thierry Reding , Alan Stern , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Instead of trying to match and probe platform and AMBA devices right after each is registered, delay their probes until device_initcall_sync. This means that devices will start probing once all built-in drivers have registered, and after all platform and AMBA devices from the DT have been registered already. This allows us to prevent deferred probes by probing dependencies on demand. Signed-off-by: Tomeu Vizoso --- Changes in v4: - Also defer probes of AMBA devices registered from the DT as they can also request resources. drivers/of/platform.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 408d89f1d124..7b33e0369374 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -164,7 +164,8 @@ static struct platform_device *of_platform_device_create_pdata( struct device_node *np, const char *bus_id, void *platform_data, - struct device *parent) + struct device *parent, + bool probe_late) { struct platform_device *dev; @@ -178,6 +179,7 @@ static struct platform_device *of_platform_device_create_pdata( dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data; + dev->dev.probe_late = probe_late; of_dma_configure(&dev->dev, dev->dev.of_node); of_msi_configure(&dev->dev, dev->dev.of_node); @@ -209,7 +211,8 @@ struct platform_device *of_platform_device_create(struct device_node *np, const char *bus_id, struct device *parent) { - return of_platform_device_create_pdata(np, bus_id, NULL, parent); + return of_platform_device_create_pdata(np, bus_id, NULL, parent, + false); } EXPORT_SYMBOL(of_platform_device_create); @@ -240,6 +243,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, dev->dev.of_node = of_node_get(node); dev->dev.parent = parent ? : &platform_bus; dev->dev.platform_data = platform_data; + dev->dev.probe_late = true; if (bus_id) dev_set_name(&dev->dev, "%s", bus_id); else @@ -358,7 +362,8 @@ static int of_platform_bus_create(struct device_node *bus, return 0; } - dev = of_platform_device_create_pdata(bus, bus_id, platform_data, parent); + dev = of_platform_device_create_pdata(bus, bus_id, platform_data, + parent, true); if (!dev || !of_match_node(matches, bus)) return 0;