Skip to content

Commit dca0b44

Browse files
johnstultz-workgregkh
authored andcommitted
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]>
1 parent 64c775f commit dca0b44

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/regulator/core.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5757,6 +5757,10 @@ static DECLARE_DELAYED_WORK(regulator_init_complete_work,
57575757

57585758
static int __init regulator_init_complete(void)
57595759
{
5760+
int delay = driver_deferred_probe_timeout;
5761+
5762+
if (delay < 0)
5763+
delay = 0;
57605764
/*
57615765
* Since DT doesn't provide an idiomatic mechanism for
57625766
* enabling full constraints and since it's much more natural
@@ -5767,18 +5771,17 @@ static int __init regulator_init_complete(void)
57675771
has_full_constraints = true;
57685772

57695773
/*
5770-
* We punt completion for an arbitrary amount of time since
5771-
* systems like distros will load many drivers from userspace
5772-
* so consumers might not always be ready yet, this is
5773-
* particularly an issue with laptops where this might bounce
5774-
* the display off then on. Ideally we'd get a notification
5775-
* from userspace when this happens but we don't so just wait
5776-
* a bit and hope we waited long enough. It'd be better if
5777-
* we'd only do this on systems that need it, and a kernel
5778-
* command line option might be useful.
5774+
* If driver_deferred_probe_timeout is set, we punt
5775+
* completion for that many seconds since systems like
5776+
* distros will load many drivers from userspace so consumers
5777+
* might not always be ready yet, this is particularly an
5778+
* issue with laptops where this might bounce the display off
5779+
* then on. Ideally we'd get a notification from userspace
5780+
* when this happens but we don't so just wait a bit and hope
5781+
* we waited long enough. It'd be better if we'd only do
5782+
* this on systems that need it.
57795783
*/
5780-
schedule_delayed_work(&regulator_init_complete_work,
5781-
msecs_to_jiffies(30000));
5784+
schedule_delayed_work(&regulator_init_complete_work, delay * HZ);
57825785

57835786
return 0;
57845787
}

0 commit comments

Comments
 (0)