From patchwork Tue Feb 25 05:08:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 212746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E990C35DF5 for ; Tue, 25 Feb 2020 05:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7655124682 for ; Tue, 25 Feb 2020 05:08:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QWV3p9i6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbgBYFIj (ORCPT ); Tue, 25 Feb 2020 00:08:39 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40611 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbgBYFIi (ORCPT ); Tue, 25 Feb 2020 00:08:38 -0500 Received: by mail-pf1-f194.google.com with SMTP id b185so6534950pfb.7 for ; Mon, 24 Feb 2020 21:08:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VjGy9mDSQTtqTfodJGzoJsBP+0BqRCAD5WnADk/Arw0=; b=QWV3p9i6zgdUqYL2d/2B5WDRt4NHawZ9OByHIbJAMrmiLd0KSO3xLeTNpgJVmrcp/0 xqki/c8H0Iv/9yANo6VcgCAnCWj0iuko5+4Zdp5ODNwpyOHZWaIktGmCJ4nXAC1JJFvd 9R0uvmxHps9ROinDk3kyZ1XeAxdr1S8gUarQvwvao6S4nhJ28Mb+vxsSFiHYEQ77omgN 8YI9LWrxpITC+nnOg+Pl1Y8Wg8b7YZ1plkloQDfuNpIDS1xzwboO0elIFvuYW3y2r778 3CTF+ftFwL+WNquuDIU4RbR2zZrtmrpGNppSCYBZdzbJkCqbczkrn/uvD9cmlAewHCBb ugsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VjGy9mDSQTtqTfodJGzoJsBP+0BqRCAD5WnADk/Arw0=; b=IzolI9i5F51QxCBSvLMDYz+h4AdKa1hU5EObks3HAxQ3nyFKUWUrs+GFEAd6buKDtJ +CHSOEDpJdy99uIDeMABMmqLbp9zCCHN0zQadaoPSxd4leXUHLqiWS5UJ+0nNzyfARMf lA/dX6KaREez9I9BiQ9Y3IHQMCbhOOJBZdIPYC74FputfypHc0p8HhMGLg7TAr7pGPLA B3cJmAgBhIXE2jcRUrMB4mI6jmEG7JPYImAHCxMMAb/ItITeU3gW1l1akvMnOBq+w2nA p8jpzM3leEcQP2wRPaqMyn4MbzGhIt+nvPZ+E2ffpy2DI6iZ2KzxfV9hpXMfSoRzTUC/ l97Q== X-Gm-Message-State: APjAAAVtK4K6jWs+SvbFWJF7GG5A5l/T3lVdbvt9YIEnbF17l/axwyXg zs3Cew4MDD13He3QHWu8BFwgpA== X-Google-Smtp-Source: APXvYqx5KRNfMIWOAh/4UQZeEBO6iVmZ2gYODKQvJ1DZC3K6GWCUjoTKnkYshlse4PleF/uQhjP5Qg== X-Received: by 2002:a63:60a:: with SMTP id 10mr49705597pgg.302.1582607317741; Mon, 24 Feb 2020 21:08:37 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:37 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 1/6] driver core: Fix driver_deferred_probe_check_state() logic Date: Tue, 25 Feb 2020 05:08:23 +0000 Message-Id: <20200225050828.56458-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org driver_deferred_probe_check_state() has some uninituitive behavior. * From boot to late_initcall, it returns -EPROBE_DEFER * From late_initcall to the deferred_probe_timeout (if set) it returns -ENODEV * If the deferred_probe_timeout it set, after it fires, it returns -ETIMEDOUT This is a bit confusing, as its useful to have the function return -EPROBE_DEFER while the timeout is still running. This behavior has resulted in the somwhat duplicative driver_deferred_probe_check_state_continue() function being added. Thus this patch tries to improve the logic, so that it behaves as such: * If late_initcall has passed, and modules are not enabled it returns -ENODEV * If modules are enabled and deferred_probe_timeout is set, it returns -EPROBE_DEFER until the timeout, afterwhich it returns -ETIMEDOUT. * In all other cases, it returns -EPROBE_DEFER This will make the deferred_probe_timeout value much more functional, and will allow us to consolidate the driver_deferred_probe_check_state() and driver_deferred_probe_check_state_continue() logic in a later patch. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Saravana Kannan Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Signed-off-by: John Stultz --- v4: * Simplified logic suggested by Andy Shevchenko * Clarified commit message to focus on logic change v5: * Cleanup comment wording as suggested by Rafael * Tweaked the logic to use Saravana's suggested conditionals --- drivers/base/dd.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index b25bcab2a26b..d75b34de6964 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -237,24 +237,26 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); static int __driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done) - return -EPROBE_DEFER; + if (!IS_ENABLED(CONFIG_MODULES) && initcalls_done) + return -ENODEV; if (!deferred_probe_timeout) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } - return 0; + return -EPROBE_DEFER; } /** * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check * - * Returns -ENODEV if init is done and all built-in drivers have had a chance - * to probe (i.e. initcalls are done), -ETIMEDOUT if deferred probe debug - * timeout has expired, or -EPROBE_DEFER if none of those conditions are met. + * Return: + * -ENODEV if initcalls have completed and modules are disabled. + * -ETIMEDOUT if the deferred probe timeout was set and has expired + * and modules are enabled. + * -EPROBE_DEFER in other cases. * * Drivers or subsystems can opt-in to calling this function instead of directly * returning -EPROBE_DEFER. @@ -264,7 +266,7 @@ int driver_deferred_probe_check_state(struct device *dev) int ret; ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) + if (ret != -ENODEV) return ret; dev_warn(dev, "ignoring dependency for device, assuming no driver"); @@ -292,7 +294,7 @@ int driver_deferred_probe_check_state_continue(struct device *dev) int ret; ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) + if (ret != -ENODEV) return ret; return -EPROBE_DEFER; From patchwork Tue Feb 25 05:08:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 212745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52CDBC35DF7 for ; Tue, 25 Feb 2020 05:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29C0524686 for ; Tue, 25 Feb 2020 05:08:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Cu6ZP2ZI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727048AbgBYFIq (ORCPT ); Tue, 25 Feb 2020 00:08:46 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43670 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727049AbgBYFIq (ORCPT ); Tue, 25 Feb 2020 00:08:46 -0500 Received: by mail-pg1-f193.google.com with SMTP id u12so6266571pgb.10 for ; Mon, 24 Feb 2020 21:08:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UKu1DiH1aE4gWTyQt4rVDR13BTjgcFDoUNycgrJmwbg=; b=Cu6ZP2ZIv35GFagdY+/LcLqaOOw+CLP2oG+i36khDGnV8jZqR9+fcfjmtSi8rmir7L Jx1LaoZjn8k7/5orzjhIAxTgMTS++qpZ/WATeHeqfZ4jMF2TstYXaTiMIt63Hf5rFPkU HLBZsZV3viwEcdZFWD4uZ3ZgmCzB54Q6z++Xu2LdT8HN4JDEUwYeMU+o2G6oG5cftukM y7ej0sQ3QrmZg8WvRtkxYZ4OdyjLUJTBxEIivl+4yyyqBrytgZceKBvx4/TkxTvlIbFa dfRZhnCHnKcjjZePiKQqRzKAcc0sYa7DHxrLEP68JvuQDo+Me44fthyCMhq4WUVHAtib OSxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UKu1DiH1aE4gWTyQt4rVDR13BTjgcFDoUNycgrJmwbg=; b=tIC9WOuDGZu29FZvpgP7wRwyAB4C6pcl8xXvu8Ilx8mJ95mHQdmLTdQDUmYWgullsj K5G0WNdQnw1sd6zVgxHKMreKZclFgCbjuV0Gc3EKMCK4Zejx408nwL8pTAgD1P1EIBJR xmltRk6TmaVWAnVb4u38SQr3ZAaKq9uUEEsIoY8uHkMYChMD0H1Qxn4te+rnL+6KOFvb a2gXRE5ehwaLoY2Q4ULKN0p5zgxp6EV7fdkh8qz7hoEmuAjftcmCVwRnnyI1Zry5krkD bKImfD5fw5shO64i+L9RVKbi1m1tKGR5tIR+gm2W3RaE2dYt/A7cKLd2/gYUq3lOL3Xe oR+A== X-Gm-Message-State: APjAAAXhPB7hq63xEoaWN3IchOElca5Z/yiIGybX8N5fRCeQ8vqrXzOK 3qV+rgBFvXXNpkKzVbAa/El8hw== X-Google-Smtp-Source: APXvYqzJ+fEVi/wIlI9WBB1N7Ce1uB1pgPc8Gi+KC1Np/LBZigKmj6Z4U+C8cgQ72ykCwoffntxxsw== X-Received: by 2002:a62:5bc7:: with SMTP id p190mr53865844pfb.16.1582607325037; Mon, 24 Feb 2020 21:08:45 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:44 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 3/6] pinctrl: Remove use of driver_deferred_probe_check_state_continue() Date: Tue, 25 Feb 2020 05:08:25 +0000 Message-Id: <20200225050828.56458-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org With the earlier sanity fixes to driver_deferred_probe_check_state() it should be usable for the pinctrl logic here. So tweak the logic to use driver_deferred_probe_check_state() instead of driver_deferred_probe_check_state_continue() Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Saravana Kannan Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Acked-by: Linus Walleij Signed-off-by: John Stultz --- drivers/pinctrl/devicetree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c index 9357f7c46cf3..1ed20ac2243f 100644 --- a/drivers/pinctrl/devicetree.c +++ b/drivers/pinctrl/devicetree.c @@ -127,11 +127,12 @@ static int dt_to_map_one_config(struct pinctrl *p, np_pctldev = of_get_next_parent(np_pctldev); if (!np_pctldev || of_node_is_root(np_pctldev)) { of_node_put(np_pctldev); + ret = driver_deferred_probe_check_state(p->dev); /* keep deferring if modules are enabled unless we've timed out */ - if (IS_ENABLED(CONFIG_MODULES) && !allow_default) - return driver_deferred_probe_check_state_continue(p->dev); - - return driver_deferred_probe_check_state(p->dev); + if (IS_ENABLED(CONFIG_MODULES) && !allow_default && + (ret == -ENODEV)) + ret = -EPROBE_DEFER; + return ret; } /* If we're creating a hog we can use the passed pctldev */ if (hog_pctldev && (np_pctldev == p->dev->of_node)) { From patchwork Tue Feb 25 05:08:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 212744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FB33C35DF2 for ; Tue, 25 Feb 2020 05:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 344EF2468B for ; Tue, 25 Feb 2020 05:08:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="rTdk+5bM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725851AbgBYFIy (ORCPT ); Tue, 25 Feb 2020 00:08:54 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41956 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728954AbgBYFIx (ORCPT ); Tue, 25 Feb 2020 00:08:53 -0500 Received: by mail-pg1-f193.google.com with SMTP id 70so6273357pgf.8 for ; Mon, 24 Feb 2020 21:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=al0yNnpxHbrkbnU0GkXBq3GBAXT9OW3YkTLBOR/+heI=; b=rTdk+5bMOM+HRL9wKEQyPyEKzfllOH6emQP6kJ0JbaGgfMspEx9D4EG6f07j0qZ6eA iUyyDaH6yh9/ilf2zj4FTE9BVjo+cQhw8secbrEa0uGoE/X9k+nW++hVRHfBotivunRX 7OMHcEKOaMXLp5ZWx+0l4FB/9Sy5LbtOpUflE9SQigrRwGpuE/udsdzLJFxIIBiwBtZu WKyX3NNNyGATkLWDTF01y187u6PFJp5dIAfcz7VNG4U7E81LdMhcIK3DuW/2hlsFNQRw NjDO9xlEkUm8JJI1O/3nV2c+B1lsYXls4TcWwu50hawLUD1LvKQbrX3seDfuWOjlHO+F 0lvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=al0yNnpxHbrkbnU0GkXBq3GBAXT9OW3YkTLBOR/+heI=; b=g6bnrjHVzZLTV46KllON2jrDDaoHDfIQBnaHy5XVUoA3thpu4e6ZO2r2pFPMQr9Gs/ 2g72VExu2iGwvduDUe3w+6GAEIJ3vBdElZe2JyvcUlxjUbo0h0dgZsMLadhVCXDffKkL 33HG6lY5rtyYfyumXuvNeK5986VO93G6WIm8gXjFYI/PDZ/WifxzY9UwjdhiycVIiJWd PYFwf6M+KrZWG+ywuaB0thmhdGGDanMhXhpXl0uTl4jADAQ9Qi4pP6aLbF8vwrEftNm1 mDeVN9r/MFRyb32lurcDHz3l4iZu5LnwHfa5BHw0IT+MzKRZNKLV1BzcDg155MaZuR7F f7eA== X-Gm-Message-State: APjAAAWRaddDk7j0JU9vnvI2d6Q9KCxj1qjKSiDytjBhWW4y97YO0TCS Kt2XMPd7mYa3978/QJPemxGKzA== X-Google-Smtp-Source: APXvYqxhk7Ltwaas8OK1QF0WV9MG82y+cNJGjUxEKBuCHPsResxQTxX7P1XMpbhqGCukyZWZ6+caHg== X-Received: by 2002:a63:28c3:: with SMTP id o186mr36905645pgo.248.1582607332765; Mon, 24 Feb 2020 21:08:52 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id r66sm15156450pfc.74.2020.02.24.21.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2020 21:08:52 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Rob Herring , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Todd Kjos , Saravana Kannan , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v5 5/6] driver core: Rename deferred_probe_timeout and make it global Date: Tue, 25 Feb 2020 05:08:27 +0000 Message-Id: <20200225050828.56458-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200225050828.56458-1-john.stultz@linaro.org> References: <20200225050828.56458-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Since other subsystems (like regulator) have similar arbitrary timeouts for how long they try to resolve driver dependencies, rename deferred_probe_timeout to driver_deferred_probe_timeout and set it as global, so it can be shared. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos Cc: Saravana Kannan Cc: Bjorn Andersson Cc: Liam Girdwood Cc: Mark Brown Cc: Thierry Reding Cc: Linus Walleij Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson Signed-off-by: John Stultz --- v4: * Split out into its own patch as suggested by Mark * Renamed deferred_probe_timeout as suggested by Greg --- drivers/base/dd.c | 16 +++++++++------- include/linux/device/driver.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index c09e4e7277d4..76888a7459d8 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -229,17 +229,19 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs); * In the case of modules, set the default probe timeout to * 30 seconds to give userland some time to load needed modules */ -static int deferred_probe_timeout = 30; +int driver_deferred_probe_timeout = 30; #else /* In the case of !modules, no probe timeout needed */ -static int deferred_probe_timeout = -1; +int driver_deferred_probe_timeout = -1; #endif +EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout); + static int __init deferred_probe_timeout_setup(char *str) { int timeout; if (!kstrtoint(str, 10, &timeout)) - deferred_probe_timeout = timeout; + driver_deferred_probe_timeout = timeout; return 1; } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); @@ -264,7 +266,7 @@ int driver_deferred_probe_check_state(struct device *dev) return -ENODEV; } - if (!deferred_probe_timeout) { + if (!driver_deferred_probe_timeout) { dev_WARN(dev, "deferred probe timeout, ignoring dependency"); return -ETIMEDOUT; } @@ -276,7 +278,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *private, *p; - deferred_probe_timeout = 0; + driver_deferred_probe_timeout = 0; driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); @@ -310,9 +312,9 @@ static int deferred_probe_initcall(void) driver_deferred_probe_trigger(); flush_work(&deferred_probe_work); - if (deferred_probe_timeout > 0) { + if (driver_deferred_probe_timeout > 0) { schedule_delayed_work(&deferred_probe_timeout_work, - deferred_probe_timeout * HZ); + driver_deferred_probe_timeout * HZ); } return 0; } diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 5242afabfaba..ee7ba5b5417e 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -236,6 +236,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) } #endif +extern int driver_deferred_probe_timeout; void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); void driver_init(void);