From patchwork Thu Feb 20 05:04:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393319 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7CE2109A for ; Thu, 20 Feb 2020 05:05:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B89FD2467D for ; Thu, 20 Feb 2020 05:05:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S2OqtMi4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbgBTFFA (ORCPT ); Thu, 20 Feb 2020 00:05:00 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:50221 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBTFFA (ORCPT ); Thu, 20 Feb 2020 00:05:00 -0500 Received: by mail-pj1-f65.google.com with SMTP id r67so362965pjb.0 for ; Wed, 19 Feb 2020 21:04:59 -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=/T58NGHopB3l5IaHe5dr2sMuh4DNsWpX5Bm1fmPX41g=; b=S2OqtMi4d7N85eKmqs1n60PvHhJ3iczKNhZd3H4xFKxZrquUWEjkKNOYhKwBBrq/yK +eOA9gZ5h1AMNe5U3gT3ELiZIEh5UG8Pfe1ACDe0dWSLrLzkN9t9IWgWyou0SwbC2YDT DtjeAbTk1XwtwSzd9qqZQhHoXaF/RykNvfqrqFM67BpFMRdjPowh1ijaNpcSZEfzOzj2 MJMNg9nJeeq8g+SPs/wEbrtaJXAuLPRczDvjJacgR8ntcZMI9FOqASEU/2DQr+R/U8Ma P+aTOaOUMgky6Uwxjg/SYPT5W9wlt5RcVA+iNFMdQQw7VydaYEDcOTX63cWT0I+rgX4P e8PQ== 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=/T58NGHopB3l5IaHe5dr2sMuh4DNsWpX5Bm1fmPX41g=; b=S9S2rS/FfZ3TRq+bhTUgETeJoKueN03gsrYIaQDcbIrH76oSafYS1jsdB5XUWpYY00 AI+D+laOuxhyFxT/IOkDcj/3vtaXpM+gMB6naWo3/rmLBQkfQaccn/SjN47Q2Bkq77la HSVy3Sp5dRvAD/+hd0Besv4FwcPsqymGmlLt6JWz3FxWg6QV5F40tVKS/d6YcJdTrUEp Vdkk3e5x3desXWTKEYwBmxbjOHRZ/T5y3qYQC4wdeyJZsYiT+BvW7EICDhtsnhH9zghv xV3uWTY8nYxMeECmOIOa3dvQR7YYhX31V/ElSBwYeACOeccsycU604+BvD2hlUisMUPG LOCw== X-Gm-Message-State: APjAAAVskHcpxs8ZXNxwlKGrRnP66Cq2svdH5HXViqMtVEgf9fZXFwRB cWexPE6kvayojC52kQmVPsov6A== X-Google-Smtp-Source: APXvYqx7blf57WRdqHC+FiTTfSehSN8U0lLCPg8GgWjsosKUg28yXPBGYhNTcpJXcdEWuI0YfQrQnA== X-Received: by 2002:a17:902:820b:: with SMTP id x11mr29388518pln.196.1582175099414; Wed, 19 Feb 2020 21:04:59 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:04:58 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 1/6] driver core: Fix driver_deferred_probe_check_state() logic Date: Thu, 20 Feb 2020 05:04:35 +0000 Message-Id: <20200220050440.45878-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-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 deferred_probe_timeout is set, it returns -EPROBE_DEFER until the timeout, afterwhich it returns -ETIMEDOUT. * If deferred_probe_timeout is not set (-1), it returns -EPROBE_DEFER until late_initcall, after which it returns 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: 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 Change-Id: I8349b7a403ce8cbce485ea0a0a5512fddffb635c Reviewed-by: Bjorn Andersson --- v4: * Simplified logic suggested by Andy Shevchenko * Clarified commit message to focus on logic change --- drivers/base/dd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index b25bcab2a26b..bb383dca39c1 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -237,7 +237,7 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); static int __driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done) + if (!initcalls_done || deferred_probe_timeout > 0) return -EPROBE_DEFER; if (!deferred_probe_timeout) { @@ -252,9 +252,11 @@ static int __driver_deferred_probe_check_state(struct device *dev) * 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. + * Returnes -EPROBE_DEFER if initcalls have not completed, or the deferred + * probe timeout is set, but not expried. + * Returns -ETIMEDOUT if the probe timeout was set and has expired. + * Returns -ENODEV if initcalls have completed and the deferred probe timeout + * was not set. * * Drivers or subsystems can opt-in to calling this function instead of directly * returning -EPROBE_DEFER. From patchwork Thu Feb 20 05:04:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58E5014BC for ; Thu, 20 Feb 2020 05:05:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 38ECF24683 for ; Thu, 20 Feb 2020 05:05:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qDZfr9MC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726423AbgBTFFC (ORCPT ); Thu, 20 Feb 2020 00:05:02 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45930 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgBTFFC (ORCPT ); Thu, 20 Feb 2020 00:05:02 -0500 Received: by mail-pg1-f196.google.com with SMTP id b9so1282689pgk.12 for ; Wed, 19 Feb 2020 21:05:02 -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=dyNzXT8jLD/h3SHy8a6cXUYQMkAeXAKSKv5N+Mj3VNM=; b=qDZfr9MCt0H7vO2O2iGnZXpDtP5E3Qw9y7loJoWPu3Sj//W9D1V3bwpfmBtms4Xo0c y6yfy3huIAtnE5UxWFpK65fS4DIrSHQFpLXMYKAj6NImy/HuUzvlH38b2SN336GjLW2P +grV3nLOxp0DzcR0vqK1R92Ly+imwIohlL8Xpci5eFMJR0vPC9Q4YNZtns4C3XB1J/rT iLYeXLknGxrnrOsXDUQuWLZ6vXxoXWbxjjXuLwZgC+dT9w/QcUb+OAsmwh1RW+9SLOgc 82NKg5tXDHCXkDfMmQbjifdqPgWa6yDzv1kwkFqvuVL6iPJ7/9X4UGYmWTylJYSBgUJG DTGg== 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=dyNzXT8jLD/h3SHy8a6cXUYQMkAeXAKSKv5N+Mj3VNM=; b=n8s3IjgsZ3ttJ3TU1KUvfvN5J9WOGmnrVjZrK6ZcFO2kb0XmLsJNPFAobxeU1phb7o a+hKvQk00QLHgoXwGhKW+rwXtvoFTNhBGtb/CKPrPbvtvlMAaSzUb2f2Fv7+tbD0+g+q knDdjRZ5Xgvm5426TyCJX6QjPXoZ/3O1lCSL+6k2d+wn8z3GjYDtV1yQyZrnJsPQa1fn SkKlbqzX3gnAJIlj0MdfenUqfjgM+ekJVhSm6SNxsW+nPDjkJrq/IkYAiOZI6DLMlwE+ R2DeAbjAuewaX/0turyfyxCXXoqutp0vc3S+bnJnrkQR1bKU4gu+rSVacwiONE0bWP1P ejpQ== X-Gm-Message-State: APjAAAVtxn8J6I+d2Ecbv11SvHfLGryHGT1F6Ol5bdQpr43fQ0X8/pAG 6k78NyXVL9i9fI2OQeMfllzk6w== X-Google-Smtp-Source: APXvYqwKxpJ3up3gMovM7cilewhjBB7h6jVLv5FEJQ5jkpiNN8ZLL6nciC7CXK+kdMoSse7byXh8eg== X-Received: by 2002:a63:ec07:: with SMTP id j7mr30998730pgh.187.1582175101605; Wed, 19 Feb 2020 21:05:01 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:01 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 2/6] driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set Date: Thu, 20 Feb 2020 05:04:36 +0000 Message-Id: <20200220050440.45878-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When using modules, its common for the modules not to be loaded until quite late by userland. With the current code, driver_deferred_probe_check_state() will stop returning EPROBE_DEFER after late_initcall, which can cause module dependency resolution to fail after that. So allow a longer window of 30 seconds (picked somewhat arbitrarily, but influenced by the similar regulator core timeout value) in the case where modules are enabled. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos 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 Change-Id: I9c5a02a54915ff53f9f14d49c601f41d7105e05e Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson --- v4: * Split out into its own patch as suggested by Mark * Made change conditional on CONFIG_MODULES --- drivers/base/dd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index bb383dca39c1..fa138f24e2d3 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -224,7 +224,16 @@ static int deferred_devs_show(struct seq_file *s, void *data) } DEFINE_SHOW_ATTRIBUTE(deferred_devs); +#ifdef CONFIG_MODULES +/* + * 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; +#else +/* In the case of !modules, no probe timeout needed */ static int deferred_probe_timeout = -1; +#endif static int __init deferred_probe_timeout_setup(char *str) { int timeout; From patchwork Thu Feb 20 05:04:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82982109A for ; Thu, 20 Feb 2020 05:05:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6367D24683 for ; Thu, 20 Feb 2020 05:05:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LH5XyaX9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbgBTFFH (ORCPT ); Thu, 20 Feb 2020 00:05:07 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:43084 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbgBTFFG (ORCPT ); Thu, 20 Feb 2020 00:05:06 -0500 Received: by mail-pg1-f194.google.com with SMTP id u12so1285534pgb.10 for ; Wed, 19 Feb 2020 21:05:05 -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=wOHv+QxDznql2h/B9QPBonJ8+Ax46oQhAeGgxF/JNeY=; b=LH5XyaX9GkiXyqpCmh8o/RmVlUzm/wMIM4fbcM8puY7zZs3tkeCMoWyQvz1qRH9rB4 i+GNjONvTcEEgSua8Qg0qqz+ExgOjFXX0Zz280K+I6tcAeU2WJazEtGW2fESRdpvRMo0 SJquQgprFLgJJuJkbwYI06B7EzImZphVYtWdVcjSnGXh0xGPCyrnYzrOGJmYtS507qjq nmlxqkwq6rJCyydRmqB3PaFDprIyfqwvuK+REsrevHVvba+3784IwzSHng/r1IMUu+CH 8CRYOzTUlXmR8o9JOtoGocZDJEzk5+a7ipJP43AYUpOJlHCLgVBmw4ibGtoGvcMIsAjV peUA== 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=wOHv+QxDznql2h/B9QPBonJ8+Ax46oQhAeGgxF/JNeY=; b=s9W6vS2lhaHE/8mrWFL/1x5o2yreJu4lhTbCt1IydpdcnT0BrlDUqtFzcEC/5yMf9L aYUCKs53Jnt7ktAPKOyFoa2gaDjA3mQH83liYwjVnZgyOaJQMuVrhG18z7OviiW+i1pv lz82ZOnxEaPzvn1l96Y21GUTiuE2HEA6yEsaPcxbCr8X0LqV+NmF8hlNqucS/PL0S8WV Q10smPztmrAbqg+yB8Gna6GBo3FI9dg0nNv4zN/G4YuKKICZFvmyxWVIzh3V27CW5wQ0 izKd+9ZMHJW9UPUKrpFqTHCaIBpGFWXPgIlMMFMfDBtj5R/4P5iIoMtMiMgkJCwsFpSi ZjAA== X-Gm-Message-State: APjAAAUZhY/XdpACNeR9fvwYGBvyH9iO4XiHxJkZz+ClaWGhS5wmGkUS RXzVUB25z1WVk2wY1ex+C9OL9w== X-Google-Smtp-Source: APXvYqzDQ6HAmjnhvjQifECUMimuCSlgupkPtgBhcHq5XHZ8TdmewbwVVAsZffG/RJMKQi2upxnz0A== X-Received: by 2002:aa7:9aa5:: with SMTP id x5mr30831744pfi.131.1582175104812; Wed, 19 Feb 2020 21:05:04 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:04 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 3/6] pinctrl: Remove use of driver_deferred_probe_check_state_continue() Date: Thu, 20 Feb 2020 05:04:37 +0000 Message-Id: <20200220050440.45878-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-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: 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 Change-Id: If72682e0a7641b33edf56f188fc067c68bbc571e Acked-by: Linus Walleij --- 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 Thu Feb 20 05:04:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD63A17F0 for ; Thu, 20 Feb 2020 05:05:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8DD8424687 for ; Thu, 20 Feb 2020 05:05:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="j2ufgc2A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbgBTFFU (ORCPT ); Thu, 20 Feb 2020 00:05:20 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:55437 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbgBTFFH (ORCPT ); Thu, 20 Feb 2020 00:05:07 -0500 Received: by mail-pj1-f65.google.com with SMTP id d5so354269pjz.5 for ; Wed, 19 Feb 2020 21:05:06 -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=aixlBG1IUMuyRnlbsO9Bddkyq8kq21Uvz9l57YstKEY=; b=j2ufgc2A6/zlTZrKnv+kOV8+1hQXXn3hsLZe88ekx9d15lUcmJnyFUmhDsip74svCh pr7/+G5aP6LdzE4a7lEJUZgNTJMhvYQE/MKQ4aG/rMEG02biDlVWqaIUw8PgVwbDxwS1 dSJ/9VHA7hhoPMtn++Xrple53Lem5Nsayidp3GA+3+TlpYNWCwa+N3TKHz5zYeol9AUp trdAnxxH31Bt/cY/j24Bq+ddIJ0mb+gOBv9XXnT3AUQdT4FVG0FHMS/eyoxgshaj0aDe NuXP3JUSwR6i0KECbbq/OVFbX3uAJmVBj+k/4sVu8kBtxetNlMs4NXbFXIasx0g2OUz6 U9Gw== 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=aixlBG1IUMuyRnlbsO9Bddkyq8kq21Uvz9l57YstKEY=; b=Ys9vmMXzuPusiJgZOxHALKzZGAXwbtZSXvcTwuhKfovWj96p2iAq5Hmsakdb/niNl0 G/nifl/uLBko2Us8Z5ScpbOwiCSAvXSzEEm8h5zTJbe8TdIT2PyACV4H+wsMNFYAYzi/ In0xSqk0CwqIfwt7ojPXU4IDQov744hXvUhxzFqCLUtIXekVUCssnzpOKjq+Rwq91BCL PIj/PRKYIqwXtmmNfHmSbHN4oyTXsb5twWXIxVBkpDC8WSsqwX34XKKoOb0swj8bwta9 FgdgMvhruWUJEvWZL0gIYHq0a1MvOR7qdZRPuQ79/DoPRh+JKqvssvYqvMxYNpPD+KBF G0xQ== X-Gm-Message-State: APjAAAXYNuT2JujqAEP6OJb+Q+3xK5FddKbgKiOVOCbMS+ZL5FvVDdQ8 iyiAcazIyX+rMVX6d+K/nZP/kg== X-Google-Smtp-Source: APXvYqzmBhGA+NC9IeOnvf5JOOp42iqCCjHX+Qckv0WLtqV7PEDyvMGdktmnkX5JTyIHsNGyOPPQUA== X-Received: by 2002:a17:90a:cc10:: with SMTP id b16mr1393657pju.55.1582175106420; Wed, 19 Feb 2020 21:05:06 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:05 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 4/6] driver core: Remove driver_deferred_probe_check_state_continue() Date: Thu, 20 Feb 2020 05:04:38 +0000 Message-Id: <20200220050440.45878-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that driver_deferred_probe_check_state() works better, and we've converted the only user of driver_deferred_probe_check_state_continue() we can simply remove it and simplify some of the logic. Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos 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 Change-Id: Id5cd5e9264cfb0fbd70a702715174cc4b10006f4 Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson --- drivers/base/dd.c | 49 +++++------------------------------ include/linux/device/driver.h | 1 - 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index fa138f24e2d3..408e4da081da 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -244,19 +244,6 @@ static int __init deferred_probe_timeout_setup(char *str) } __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); -static int __driver_deferred_probe_check_state(struct device *dev) -{ - if (!initcalls_done || deferred_probe_timeout > 0) - return -EPROBE_DEFER; - - if (!deferred_probe_timeout) { - dev_WARN(dev, "deferred probe timeout, ignoring dependency"); - return -ETIMEDOUT; - } - - return 0; -} - /** * driver_deferred_probe_check_state() - Check deferred probe state * @dev: device to check @@ -272,43 +259,19 @@ static int __driver_deferred_probe_check_state(struct device *dev) */ int driver_deferred_probe_check_state(struct device *dev) { - int ret; + if (!initcalls_done || deferred_probe_timeout > 0) + return -EPROBE_DEFER; - ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) - return ret; + if (!deferred_probe_timeout) { + dev_WARN(dev, "deferred probe timeout, ignoring dependency"); + return -ETIMEDOUT; + } dev_warn(dev, "ignoring dependency for device, assuming no driver"); return -ENODEV; } -/** - * driver_deferred_probe_check_state_continue() - check deferred probe state - * @dev: device to check - * - * Returns -ETIMEDOUT if deferred probe debug timeout has expired, or - * -EPROBE_DEFER otherwise. - * - * Drivers or subsystems can opt-in to calling this function instead of - * directly returning -EPROBE_DEFER. - * - * This is similar to driver_deferred_probe_check_state(), but it allows the - * subsystem to keep deferring probe after built-in drivers have had a chance - * to probe. One scenario where that is useful is if built-in drivers rely on - * resources that are provided by modular drivers. - */ -int driver_deferred_probe_check_state_continue(struct device *dev) -{ - int ret; - - ret = __driver_deferred_probe_check_state(dev); - if (ret < 0) - return ret; - - return -EPROBE_DEFER; -} - static void deferred_probe_timeout_work_func(struct work_struct *work) { struct device_private *private, *p; diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 1188260f9a02..5242afabfaba 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -238,7 +238,6 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev) void driver_deferred_probe_add(struct device *dev); int driver_deferred_probe_check_state(struct device *dev); -int driver_deferred_probe_check_state_continue(struct device *dev); void driver_init(void); /** From patchwork Thu Feb 20 05:04:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393323 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B900F109A for ; Thu, 20 Feb 2020 05:05:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9113C24687 for ; Thu, 20 Feb 2020 05:05:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="KWtAXqoH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726940AbgBTFFM (ORCPT ); Thu, 20 Feb 2020 00:05:12 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40238 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726893AbgBTFFM (ORCPT ); Thu, 20 Feb 2020 00:05:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id b185so1290393pfb.7 for ; Wed, 19 Feb 2020 21:05:10 -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=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=KWtAXqoH66/xVX33DhMaKTUdGX6Uf98AbL57ah+k6dEdauNQwApvPnNPHUiivq6Jdi 49xLg0mTm79BVYHbdcVGHKDyfCI7Yt8YhnlXGJHea2d2Y16+X+iCM76wvPNmXrV4dhfb KKtxMQCoagp0X+c11lVO9afWRHTd6fPbsvUjdhWnY6dEPBMgam5bDsEJ0yD01A23gyxO XyvFyW3dEfa9OwDK55NIUQRusiahMNtBIZGwbpxIjB1xAdamE56cpYEcFU/u6PxFnaWt V6wbP8AjfqY2Y56H4t559cVNwx9C1p0h6Vw2CRmcPmowj7AN8PIhT+73joESZcCRHPmP 3dBg== 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=aW+BwlvCbf3aWaQh47QJ3yNM7VLxHMAzfks9zOaajkM=; b=gsoPmPO2vtpgI78+fdx12iSB3DZytlt8YyDbPv6Nc1CphRUfU+dgjOc2RT3VAopt9Q qEI0tYAmi4ohGLNvGX9Ib/VaLnAOlVJf2jFI72rK4xz4R3iqttVvUhlV4JlEUOIwJLLw D8Mnk5144wYR76RNggB17/eBXEZFj+6HazuC+YapKgXzFPtpksXIiMUfPeKPi+whW0Ac C5P+5jt1GnfjYOdxHy5phJSa9w6O7DTY37DWELydb41Lm873LN8CeltjsyxtmmwU5+Ff 1uY23B3O77BNwCsH2iJ+JMEw37V07TPz25dIJzVUOaLGzUHQZz7ScDvV9H6FKt2ruJFx HrSw== X-Gm-Message-State: APjAAAWmZk5Mg5/eFg4Jzeme6Z7KBZLIgOTvmJGfOhyXKvh0vQZZbOFP OeBgG7q5b1ZIbku/yLv0tJepTw== X-Google-Smtp-Source: APXvYqxtOMEIAg/0vMNdo4l2g1zhUCi8GqsKzxUcztilwfCWBSoXPh54dpJIreh60u0UmWS9iVnVSQ== X-Received: by 2002:a63:fc51:: with SMTP id r17mr31212077pgk.292.1582175109855; Wed, 19 Feb 2020 21:05:09 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:09 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 5/6] driver core: Rename deferred_probe_timeout and make it global Date: Thu, 20 Feb 2020 05:04:39 +0000 Message-Id: <20200220050440.45878-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-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: 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 Change-Id: I92ee3b392004ecc9217c5337b54eda48c2d7f3ee Reviewed-by: Rafael J. Wysocki Reviewed-by: Bjorn Andersson --- v4: * Split out into its own patch as suggested by Mark * Renamed deferred_probe_timeout as suggested by Greg --- drivers/base/dd.c | 18 ++++++++++-------- include/linux/device/driver.h | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 408e4da081da..39f1ce6d4f1c 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); @@ -259,10 +261,10 @@ __setup("deferred_probe_timeout=", deferred_probe_timeout_setup); */ int driver_deferred_probe_check_state(struct device *dev) { - if (!initcalls_done || deferred_probe_timeout > 0) + if (!initcalls_done || driver_deferred_probe_timeout > 0) return -EPROBE_DEFER; - 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); From patchwork Thu Feb 20 05:04:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11393325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8DA6109A for ; Thu, 20 Feb 2020 05:05:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8D032467D for ; Thu, 20 Feb 2020 05:05:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="W0USwnkt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726967AbgBTFFP (ORCPT ); Thu, 20 Feb 2020 00:05:15 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43092 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726907AbgBTFFM (ORCPT ); Thu, 20 Feb 2020 00:05:12 -0500 Received: by mail-pg1-f193.google.com with SMTP id u12so1285713pgb.10 for ; Wed, 19 Feb 2020 21:05:12 -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=BkWD602W7Q9Y+URRx5RQh3vyLJ/+/ea+Ab7cyJ2LVzU=; b=W0USwnktWAK949xSvqdULNruXCEUOenrU262+fUtA5vIIvMRyM7oAKyJ2bEQImhS6m K1AYiV0U3IhjqjrBZ7WeSj+TEmzIa0CEdiE1NK0sKuRLkPKyAgJeGCfOiDCEqGoIUGJN 4W4IICZWBwQz9RJNue/bLLa+h6Q+MR8Im/7yxK1qUkPLuoZgprZfGo7P3PO7f89j9t+a I9rc1moqCiUG4Nktof1lcbQmGnz1w3NEOogwoKftsxf3Wyy3TbLs4dSBlmNav/6MLW1Z a26GHEo+6b7/2njVg0CKhg/mBjpSSjop2uLJ8ki2BG/MRcqeDZ2/NGtvq9sc38FIe08y tkGw== 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=BkWD602W7Q9Y+URRx5RQh3vyLJ/+/ea+Ab7cyJ2LVzU=; b=F5ot3NTjn9NTUmyfLbH/YsVkdZVW8auKAKGBG6xpTXcDJZDge40UxUo2kHk2mjz9pn vExOaaYArlza6GyusdOoyd88YGgDLHkpmGnlBegANhKYqH+H11og/lVr8KgWz8KOWsLV b1vlExwqnjxcICdf+Bs5DThIzRejjuuylasYaxMKJcOqm7ihIezv+jizrsGHIPAt4zyF ffkmJy9Py5uTPcA5URQWa9Z0pQ8+lfSTe+8fF57N1S5nwZIDy07rLoC7E9IezR03Y1HJ 8Ul6enP8E6r8s10BQ1a2A0rkc9nvZtDZfe4O5jFnDT61PXjZYnNRC7Swc7vgnAXvutKF 0rIQ== X-Gm-Message-State: APjAAAWgiP4CC+wyvzf3G5wQoNUyfI/nHZEOszzOc8eK4uUCNwr7gvgF yB5LAJB9sFhapRg6blnJkK7CjA== X-Google-Smtp-Source: APXvYqxpWD81Pg4dHENS3JJ0u393+opZJgCR2EPptBx14uageSAhKbCtURu5uLMMtHA2wUTm2HBiIw== X-Received: by 2002:a65:478a:: with SMTP id e10mr30287883pgs.197.1582175111731; Wed, 19 Feb 2020 21:05:11 -0800 (PST) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id z4sm1400847pfn.42.2020.02.19.21.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 21:05:11 -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 , Bjorn Andersson , Liam Girdwood , Mark Brown , Thierry Reding , Linus Walleij , Greg Kroah-Hartman , linux-pm@vger.kernel.org Subject: [PATCH v4 6/6] regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work Date: Thu, 20 Feb 2020 05:04:40 +0000 Message-Id: <20200220050440.45878-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200220050440.45878-1-john.stultz@linaro.org> References: <20200220050440.45878-1-john.stultz@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The regulator_init_complete_work logic defers the cleanup for an arbitrary 30 seconds of time to allow modules loaded by userland to start. This arbitrary timeout is similar to the driver_deferred_probe_timeout value, and its been suggested we align these so users have a method to extend the timeouts as needed. So this patch changes the logic to use the driver_deferred_probe_timeout value if it is set, otherwise we directly call the regulator_init_complete_work_function(). Cc: Rob Herring Cc: "Rafael J. Wysocki" Cc: Kevin Hilman Cc: Ulf Hansson Cc: Pavel Machek Cc: Len Brown Cc: Todd Kjos 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 Change-Id: I9fa2411abbb91ed4dd0edc41e8cc8583577c005b --- v4: * Split out into its own patch, as suggested by Mark --- drivers/regulator/core.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d015d99cb59d..394e7b11576a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5767,18 +5767,21 @@ static int __init regulator_init_complete(void) has_full_constraints = true; /* - * We punt completion for an arbitrary amount of time since - * systems like distros will load many drivers from userspace - * so consumers might not always be ready yet, this is - * particularly an issue with laptops where this might bounce - * the display off then on. Ideally we'd get a notification - * from userspace when this happens but we don't so just wait - * a bit and hope we waited long enough. It'd be better if - * we'd only do this on systems that need it, and a kernel - * command line option might be useful. + * If driver_deferred_probe_timeout is set, we punt + * completion for that many seconds since systems like + * distros will load many drivers from userspace so consumers + * might not always be ready yet, this is particularly an + * issue with laptops where this might bounce the display off + * then on. Ideally we'd get a notification from userspace + * when this happens but we don't so just wait a bit and hope + * we waited long enough. It'd be better if we'd only do + * this on systems that need it. */ - schedule_delayed_work(®ulator_init_complete_work, - msecs_to_jiffies(30000)); + if (driver_deferred_probe_timeout >= 0) + schedule_delayed_work(®ulator_init_complete_work, + driver_deferred_probe_timeout * HZ); + else + regulator_init_complete_work_function(NULL); return 0; }