From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
Rob Herring <robh@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>, Pavel Machek <pavel@ucw.cz>,
Len Brown <len.brown@intel.com>, Todd Kjos <tkjos@google.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Thierry Reding <treding@nvidia.com>,
Linus Walleij <linus.walleij@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 6/6] regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work
Date: Thu, 20 Feb 2020 08:05:22 -0800 [thread overview]
Message-ID: <20200220160522.GH955802@ripper> (raw)
In-Reply-To: <20200220050440.45878-7-john.stultz@linaro.org>
On Wed 19 Feb 21:04 PST 2020, John Stultz wrote:
> 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 <robh@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Kevin Hilman <khilman@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Todd Kjos <tkjos@google.com>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Thierry Reding <treding@nvidia.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> Change-Id: I9fa2411abbb91ed4dd0edc41e8cc8583577c005b
Change-Id...
> ---
> 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);
Why not schedule_delayed_work(..., 0) in this case, to get it off the
initcall context and to avoid the difference in execution paths?
Regards,
Bjorn
>
> return 0;
> }
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-02-20 16:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-20 5:04 [PATCH v4 0/6] driver core: Try to improve and cleanup driver_deferred_probe_check_state() John Stultz
2020-02-20 5:04 ` [PATCH v4 1/6] driver core: Fix driver_deferred_probe_check_state() logic John Stultz
2020-02-20 10:28 ` Rafael J. Wysocki
2020-02-20 15:55 ` Bjorn Andersson
2020-02-20 23:40 ` Pavel Machek
2020-02-20 23:42 ` John Stultz
2020-02-20 5:04 ` [PATCH v4 2/6] driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set John Stultz
2020-02-20 10:36 ` Rafael J. Wysocki
2020-02-20 15:55 ` Bjorn Andersson
2020-02-20 5:04 ` [PATCH v4 3/6] pinctrl: Remove use of driver_deferred_probe_check_state_continue() John Stultz
2020-02-21 15:21 ` Linus Walleij
2020-02-21 17:19 ` John Stultz
2020-02-20 5:04 ` [PATCH v4 4/6] driver core: Remove driver_deferred_probe_check_state_continue() John Stultz
2020-02-20 10:38 ` Rafael J. Wysocki
2020-02-20 15:59 ` Bjorn Andersson
2020-02-20 5:04 ` [PATCH v4 5/6] driver core: Rename deferred_probe_timeout and make it global John Stultz
2020-02-20 10:42 ` Rafael J. Wysocki
2020-02-20 16:00 ` Bjorn Andersson
2020-02-20 5:04 ` [PATCH v4 6/6] regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work John Stultz
2020-02-20 16:05 ` Bjorn Andersson [this message]
2020-02-20 10:15 ` [PATCH v4 0/6] driver core: Try to improve and cleanup driver_deferred_probe_check_state() Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200220160522.GH955802@ripper \
--to=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=robh@kernel.org \
--cc=tkjos@google.com \
--cc=treding@nvidia.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).