Re: [PATCH v3] driver core: Don't set a deferred probe timeout if modules are disabled

From: Andrew Halaney
Date: Wed Feb 28 2024 - 17:23:02 EST


On Wed, Feb 28, 2024 at 12:09:02AM +0100, Javier Martinez Canillas wrote:
> There is no point to schedule the workqueue to timeout the deferred probe,
> if all the initcalls are done and modules are not enabled. The default for
> this case is already 0 but can be overridden by the deferred_probe_timeout
> parameter. Let's just skip this and avoid queuing work that is not needed.
>
> Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>

Reviewed-by: Andrew Halaney <ahalaney@xxxxxxxxxx>

> ---
>
> Changes in v3:
> - Just skip setting the deferred_probe_timeout parameter when modules
> are disabled (Andrew Halaney).
>
> drivers/base/dd.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index 85152537dbf1..48a45860d2bb 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -266,6 +266,13 @@ static int __init deferred_probe_timeout_setup(char *str)
> {
> int timeout;
>
> + /*
> + * If loadable modules support is disabled, there is no point to
> + * set a timeout for the deferred probe and schedule a workqueue.
> + */
> + if (!IS_ENABLED(CONFIG_MODULES))
> + return 1;
> +
> if (!kstrtoint(str, 10, &timeout))
> driver_deferred_probe_timeout = timeout;
> return 1;
> --
> 2.43.2
>