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: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Cc: Saravana Kannan <[email protected]>
Cc: Todd Kjos <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Rob Herring <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: John Stultz <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
John Stultz authored and Greg Kroah-Hartman committed 2020-03-04 18:11:45 +01:00
1 parent 64c775fb4b
commit dca0b44957
1 file changed
+14 -11
+14 -11
View File
@@ -5757,6 +5757,10 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work,
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
* enabling full constraints and since it's much more natural
@@ -5767,18 +5771,17 @@ 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(&regulator_init_complete_work,
msecs_to_jiffies(30000));
schedule_delayed_work(&regulator_init_complete_work, delay * HZ);
return 0;
}