[PATCH v1] driver core: Add CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT
From: Saravana Kannan
Date: Mon Mar 13 2023 - 19:27:30 EST
Add a build time equivalent of fw_devlink.sync_state=timeout so that
board specific kernels could enable it and not have to deal with setting
or cluttering the kernel commandline.
Cc: Doug Anderson <dianders@xxxxxxxxxxxx>
Signed-off-by: Saravana Kannan <saravanak@xxxxxxxxxx>
---
drivers/base/Kconfig | 10 ++++++++++
drivers/base/core.c | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 6f04b831a5c0..da91b409482f 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -230,4 +230,14 @@ config GENERIC_ARCH_NUMA
Enable support for generic NUMA implementation. Currently, RISC-V
and ARM64 use it.
+config FW_DEVLINK_SYNC_STATE_TIMEOUT
+ bool
+ default n
+ help
+ This is build time equivalent of adding kernel commandline parameter
+ "fw_devlink.sync_state=timeout". Give up waiting on consumers and
+ call sync_state() on any devices that haven't yet received their
+ sync_state() calls after deferred_probe_timeout has expired or by
+ late_initcall() if !CONFIG_MODULES.
+
endmenu
diff --git a/drivers/base/core.c b/drivers/base/core.c
index fe74a786e2c3..adc81871829f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1672,7 +1672,12 @@ early_param("fw_devlink.strict", fw_devlink_strict_setup);
#define FW_DEVLINK_SYNC_STATE_STRICT 0
#define FW_DEVLINK_SYNC_STATE_TIMEOUT 1
+#ifndef CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT
static int fw_devlink_sync_state;
+#else
+static int fw_devlink_sync_state = FW_DEVLINK_SYNC_STATE_TIMEOUT;
+#endif
+
static int __init fw_devlink_sync_state_setup(char *arg)
{
if (!arg)
--
2.40.0.rc1.284.g88254d51c5-goog