diff mbox series

[v2,01/18] common: Kconfig: Introduce CONFIG_CONSOLE_RECORD_INIT_F

Message ID 20201122083556.6756-2-ovidiu.panait@windriver.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Minor board_f/board_r cleanups | expand

Commit Message

Ovidiu Panait Nov. 22, 2020, 8:35 a.m. UTC
Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
 defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
v2 updates:
- new patch

 common/Kconfig   | 8 ++++++++
 common/board_f.c | 7 +++----
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Simon Glass Nov. 23, 2020, 1:28 a.m. UTC | #1
On Sun, 22 Nov 2020 at 01:37, Ovidiu Panait <ovidiu.panait@windriver.com> wrote:
>
> Currently, the following #ifdef construct is used to check whether to run
> console_record_init() during pre-relocation init:
>  defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)
>
> Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
> complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
> ---
> v2 updates:
> - new patch
>
>  common/Kconfig   | 8 ++++++++
>  common/board_f.c | 7 +++----
>  2 files changed, 11 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/common/Kconfig b/common/Kconfig
> index 2bce8c9ba1..6f6abc7cbf 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -17,6 +17,14 @@ config CONSOLE_RECORD
>           To enable console recording, call console_record_reset_enable()
>           from your code.
>
> +config CONSOLE_RECORD_INIT_F
> +       bool "Enable console recording during pre-relocation init"
> +       depends on CONSOLE_RECORD && SYS_MALLOC_F
> +       default y if SYS_MALLOC_F

Is default y enough here?

> +       help
> +         This option enables console recording during pre-relocation init.
> +         CONFIG_SYS_MALLOC_F must be enabled to use this feature.
> +
>  config CONSOLE_RECORD_OUT_SIZE
>         hex "Output buffer size"
>         depends on CONSOLE_RECORD

[..]
diff mbox series

Patch

diff --git a/common/Kconfig b/common/Kconfig
index 2bce8c9ba1..6f6abc7cbf 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -17,6 +17,14 @@  config CONSOLE_RECORD
 	  To enable console recording, call console_record_reset_enable()
 	  from your code.
 
+config CONSOLE_RECORD_INIT_F
+	bool "Enable console recording during pre-relocation init"
+	depends on CONSOLE_RECORD && SYS_MALLOC_F
+	default y if SYS_MALLOC_F
+	help
+	  This option enables console recording during pre-relocation init.
+	  CONFIG_SYS_MALLOC_F must be enabled to use this feature.
+
 config CONSOLE_RECORD_OUT_SIZE
 	hex "Output buffer size"
 	depends on CONSOLE_RECORD
diff --git a/common/board_f.c b/common/board_f.c
index 9f441c44f1..e5e69ff0fa 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -767,11 +767,10 @@  static int initf_bootstage(void)
 
 static int initf_console_record(void)
 {
-#if defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)
-	return console_record_init();
-#else
+	if (IS_ENABLED(CONFIG_CONSOLE_RECORD_INIT_F))
+		return console_record_init();
+
 	return 0;
-#endif
 }
 
 static int initf_dm(void)