Merge tag 'regulator-spi-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/broon...
[platform/kernel/linux-rpi.git] / drivers / regulator / core.c
index 7486f6e..c340505 100644 (file)
@@ -5754,6 +5754,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
@@ -5764,18 +5768,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;
 }