Skip to contentSkip to conversation

env: Switch the callback static list to Kconfig

PATCH In review Christoph Niedermaier 2 participants 2 messages Nov 20, 2024 – Dec 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 env: Switch the callback static list to Kconfig

Switch the callback static list from the board configuration variable CFG_ENV_CALLBACK_LIST_STATIC to Kconfig CONFIG_ENV_CALLBACK_LIST_STATIC.

---
Cc: Joe Hershberger <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
---
V2: - Fix typo in commit message

---
 doc/develop/environment.rst |  4 ++--
 env/Kconfig                 | 13 +++++++++++++
 include/env_callback.h      |  7 +------
 3 files changed, 16 insertions(+), 8 deletions(-)
doc/develop/environment.rst +2 -2
index e1783462bb..e46cd39d60 100644
@@ -18,8 +18,8 @@ The callbacks are named and associated with a function using the
 U_BOOT_ENV_CALLBACK macro in your board or driver code.
 
 These callbacks are associated with variables in one of two ways.  The
-static list can be added to by defining CFG_ENV_CALLBACK_LIST_STATIC
-in the board configuration to a string that defines a list of
+static list can be added to by defining CONFIG_ENV_CALLBACK_LIST_STATIC
+in the board defconfig via menuconfig to a string that defines a list of
 associations.  The list must be in the following format::
 
     entry = variable_name[:callback_name]
env/Kconfig +13 -0
index 031cf58186..aaf0b1fe9a 100644
@@ -21,6 +21,19 @@ config ENV_SOURCE_FILE
 	  environment is assumed to come from the ad-hoc
 	  CFG_EXTRA_ENV_SETTINGS #define
 
+config ENV_CALLBACK_LIST_STATIC
+	string "Static callbacks list"
+	default ""
+	help
+	  The environment callbacks are associated with variables in a
+	  static list. Define this list in the following format:
+
+	  entry = variable_name[:callback_name]
+	  list = entry[,list]
+
+	  If the callback name is not specified, then the callback is deleted.
+	  Spaces are also allowed anywhere in the list.
+
 config SAVEENV
 	def_bool y if CMD_SAVEENV
 
include/env_callback.h +1 -6
index bc8ff1923e..47a31f6cf5 100644
@@ -14,11 +14,6 @@
 
 #define ENV_CALLBACK_VAR ".callbacks"
 
-/* Board configs can define additional static callback bindings */
-#ifndef CFG_ENV_CALLBACK_LIST_STATIC
-#define CFG_ENV_CALLBACK_LIST_STATIC
-#endif
-
 #ifdef CONFIG_SILENT_CONSOLE
 #define SILENT_CALLBACK "silent:silent,"
 #else
@@ -90,7 +85,7 @@
 	SILENT_CALLBACK \
 	"stdin:console,stdout:console,stderr:console," \
 	"serial#:serialno," \
-	CFG_ENV_CALLBACK_LIST_STATIC
+	CONFIG_ENV_CALLBACK_LIST_STATIC
 
 #ifndef CONFIG_XPL_BUILD
 void env_callback_init(struct env_entry *var_entry);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 4 lines · Christoph Niedermaier

Switch the callback static list from the board configuration variable CFG_ENV_CALLBACK_LIST_STATIC to Kconfig CONFIG_ENV_CALLBACK_LIST_STATIC.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom