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

Message ID 20240227231001.648698-1-javierm@redhat.com
State New
Headers
Series [v3] driver core: Don't set a deferred probe timeout if modules are disabled |

Commit Message

Javier Martinez Canillas Feb. 27, 2024, 11:09 p.m. UTC
  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@redhat.com>
---

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(+)
  

Comments

Andrew Halaney Feb. 28, 2024, 10:22 p.m. UTC | #1
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@redhat.com>

Reviewed-by: Andrew Halaney <ahalaney@redhat.com>

> ---
> 
> 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
>
  

Patch

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;