From patchwork Wed Jun 17 13:42:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6626181 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 96D19C0020 for ; Wed, 17 Jun 2015 13:46:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B379A2062F for ; Wed, 17 Jun 2015 13:46:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CB70A2041F for ; Wed, 17 Jun 2015 13:46:21 +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 1Z5DdV-0003e8-7x; Wed, 17 Jun 2015 13:44:13 +0000 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dcc-0002TM-R5 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2015 13:43:19 +0000 Received: by wgbhy7 with SMTP id hy7so37476501wgb.2 for ; Wed, 17 Jun 2015 06:42:56 -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; bh=GhyeD2aSLFDup+OGmLiXURAnukMAwHgD73jwQSnO8hU=; b=SnQTb44ZJZLEmhW4AGkNRxE/Ge3Jh9G9rI0biarz19IHauUM9Xwe6sGN+619Jg3Y/u yFwiBOHdSJralC2EwEuNGimlpRn3O1LkvdFWGUvbBdO+tB0LRkCtI7mm9tX/FFhfv1ph W+pea+5LX4wee+Ai862jzkRiYbRZc09SssLRv7pbJOOL6zuLxOiKgkuHj7qBvQot+JL8 GuZhGoIRASe2J6XyzqfiX2Erg8epW2HR5/+dhiHIn3BZbeX8rLpe5DVE7c4zlwefcKEo cSoN7Gd6orOyxi9tlCl9ZthRbrcwjNir7Y07IH/B/bqqOp3qP2sxozxnfd2MjDbzXY9k 1VHw== X-Received: by 10.180.85.8 with SMTP id d8mr34669643wiz.11.1434548576424; Wed, 17 Jun 2015 06:42:56 -0700 (PDT) Received: from cizrna.lan ([109.72.12.132]) by mx.google.com with ESMTPSA id v3sm6920361wja.31.2015.06.17.06.42.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 06:42:55 -0700 (PDT) From: Tomeu Vizoso To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 02/13] driver-core: defer all probes until late_initcall Date: Wed, 17 Jun 2015 15:42:12 +0200 Message-Id: <1434548543-22949-3-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> References: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_064319_074680_382927BE X-CRM114-Status: GOOD ( 12.45 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , Krzysztof Kozlowski , Linus Walleij , Andrzej Hajda , Thierry Reding , Lv Zheng , Alexander Holler , Alexandre Courbot , Russell King , Pawel Moll , Stephen Warren , Robert Moore , Grant Likely , Len Brown , Arnd Bergmann , Ian Campbell , Rob Herring , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Tomeu Vizoso , Greg Kroah-Hartman , Dmitry Torokhov , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mark Brown , Kumar Gala , Javier Martinez Canillas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 To decrease the chances of devices deferring their probes because of dependencies not having probed yet because of their drivers not having registered yet, delay all probing until the late initcall level. This will allow us to avoid deferred probes completely later by probing dependencies on demand, or by probing them in dependency order. Signed-off-by: Tomeu Vizoso --- drivers/base/dd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index a638bbb..18438aa 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -407,6 +407,12 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) if (!device_is_registered(dev)) return -ENODEV; + /* Defer all probes until we start processing the queue */ + if (!driver_deferred_probe_enable) { + driver_deferred_probe_add(dev); + return 0; + } + pr_debug("bus: '%s': %s: matched device %s with driver %s\n", drv->bus->name, __func__, dev_name(dev), drv->name); @@ -585,7 +591,7 @@ EXPORT_SYMBOL_GPL(device_attach); void device_initial_probe(struct device *dev) { - __device_attach(dev, true); + __device_attach(dev, driver_deferred_probe_enable); } static int __driver_attach(struct device *dev, void *data)