Commit dca0b449 authored by John Stultz's avatar John Stultz Committed by Greg Kroah-Hartman

regulator: Use driver_deferred_probe_timeout for regulator_init_complete_work

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 for the delay value if it
is set (using a delay of 0 if it is not).

Cc: linux-pm@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Saravana Kannan <saravanak@google.com>
Cc: Todd Kjos <tkjos@google.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Kevin Hilman <khilman@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Rob Herring <robh@kernel.org>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Link: https://lore.kernel.org/r/20200225050828.56458-7-john.stultz@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 64c775fb
...@@ -5757,6 +5757,10 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work, ...@@ -5757,6 +5757,10 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work,
static int __init regulator_init_complete(void) static int __init regulator_init_complete(void)
{ {
int delay = driver_deferred_probe_timeout;
if (delay < 0)
delay = 0;
/* /*
* Since DT doesn't provide an idiomatic mechanism for * Since DT doesn't provide an idiomatic mechanism for
* enabling full constraints and since it's much more natural * enabling full constraints and since it's much more natural
...@@ -5767,18 +5771,17 @@ static int __init regulator_init_complete(void) ...@@ -5767,18 +5771,17 @@ static int __init regulator_init_complete(void)
has_full_constraints = true; has_full_constraints = true;
/* /*
* We punt completion for an arbitrary amount of time since * If driver_deferred_probe_timeout is set, we punt
* systems like distros will load many drivers from userspace * completion for that many seconds since systems like
* so consumers might not always be ready yet, this is * distros will load many drivers from userspace so consumers
* particularly an issue with laptops where this might bounce * might not always be ready yet, this is particularly an
* the display off then on. Ideally we'd get a notification * issue with laptops where this might bounce the display off
* from userspace when this happens but we don't so just wait * then on. Ideally we'd get a notification from userspace
* a bit and hope we waited long enough. It'd be better if * when this happens but we don't so just wait a bit and hope
* we'd only do this on systems that need it, and a kernel * we waited long enough. It'd be better if we'd only do
* command line option might be useful. * this on systems that need it.
*/ */
schedule_delayed_work(&regulator_init_complete_work, schedule_delayed_work(&regulator_init_complete_work, delay * HZ);
msecs_to_jiffies(30000));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment