From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbbIGM1n (ORCPT ); Mon, 7 Sep 2015 08:27:43 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35883 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751024AbbIGMYs (ORCPT ); Mon, 7 Sep 2015 08:24:48 -0400 From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Cc: Rob Herring , Stephen Warren , Javier Martinez Canillas , Mark Brown , Thierry Reding , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, Dmitry Torokhov , devicetree@vger.kernel.org, Linus Walleij , linux-acpi@vger.kernel.org, Arnd Bergmann , Tomeu Vizoso , Frank Rowand , Grant Likely Subject: [PATCH v4 22/22] of/platform: Defer probes of registered devices Date: Mon, 7 Sep 2015 14:23:47 +0200 Message-Id: <1441628627-5143-23-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1441628627-5143-1-git-send-email-tomeu.vizoso@collabora.com> References: <1441628627-5143-1-git-send-email-tomeu.vizoso@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Changes in v3: None Changes in v2: None 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 f089d95ac961..a9397ce838ea 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; -- 2.4.3