Skip to content

Commit

Permalink
driver core: Rename deferred_probe_timeout and make it global
Browse files Browse the repository at this point in the history
Since other subsystems (like regulator) have similar arbitrary
timeouts for how long they try to resolve driver dependencies,
rename deferred_probe_timeout to driver_deferred_probe_timeout
and set it as global, so it can be shared.

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>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Link: https://lore.kernel.org/r/20200225050828.56458-6-john.stultz@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
John Stultz authored and Greg Kroah-Hartman committed Mar 4, 2020
1 parent 0e9f8d0 commit 64c775f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,19 @@ DEFINE_SHOW_ATTRIBUTE(deferred_devs);
* In the case of modules, set the default probe timeout to
* 30 seconds to give userland some time to load needed modules
*/
static int deferred_probe_timeout = 30;
int driver_deferred_probe_timeout = 30;
#else
/* In the case of !modules, no probe timeout needed */
static int deferred_probe_timeout = -1;
int driver_deferred_probe_timeout = -1;
#endif
EXPORT_SYMBOL_GPL(driver_deferred_probe_timeout);

static int __init deferred_probe_timeout_setup(char *str)
{
int timeout;

if (!kstrtoint(str, 10, &timeout))
deferred_probe_timeout = timeout;
driver_deferred_probe_timeout = timeout;
return 1;
}
__setup("deferred_probe_timeout=", deferred_probe_timeout_setup);
Expand All @@ -264,7 +266,7 @@ int driver_deferred_probe_check_state(struct device *dev)
return -ENODEV;
}

if (!deferred_probe_timeout) {
if (!driver_deferred_probe_timeout) {
dev_WARN(dev, "deferred probe timeout, ignoring dependency");
return -ETIMEDOUT;
}
Expand All @@ -276,7 +278,7 @@ static void deferred_probe_timeout_work_func(struct work_struct *work)
{
struct device_private *private, *p;

deferred_probe_timeout = 0;
driver_deferred_probe_timeout = 0;
driver_deferred_probe_trigger();
flush_work(&deferred_probe_work);

Expand Down Expand Up @@ -310,9 +312,9 @@ static int deferred_probe_initcall(void)
driver_deferred_probe_trigger();
flush_work(&deferred_probe_work);

if (deferred_probe_timeout > 0) {
if (driver_deferred_probe_timeout > 0) {
schedule_delayed_work(&deferred_probe_timeout_work,
deferred_probe_timeout * HZ);
driver_deferred_probe_timeout * HZ);
}
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/device/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ driver_find_device_by_acpi_dev(struct device_driver *drv, const void *adev)
}
#endif

extern int driver_deferred_probe_timeout;
void driver_deferred_probe_add(struct device *dev);
int driver_deferred_probe_check_state(struct device *dev);
void driver_init(void);
Expand Down

0 comments on commit 64c775f

Please sign in to comment.