dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2020-10-03 11:31:26 -06:00
parent 1b27273e09
commit abb9cd30b2
4 changed files with 18 additions and 5 deletions

View File

@ -40,10 +40,24 @@ config DM_WARN
depends on DM depends on DM
default y default y
help help
Enable this to see warnings related to driver model.
Warnings may help with debugging, such as when expected devices do
not bind correctly. If the option is disabled, dm_warn() is compiled
out - it will do nothing when called.
config SPL_DM_WARN
bool "Enable warnings in driver model wuth SPL"
depends on SPL_DM
help
Enable this to see warnings related to driver model in SPL
The dm_warn() function can use up quite a bit of space for its The dm_warn() function can use up quite a bit of space for its
strings. By default this is disabled for SPL builds to save space. strings. By default this is disabled for SPL builds to save space.
This will cause dm_warn() to be compiled out - it will do nothing
when called. Warnings may help with debugging, such as when expected devices do
not bind correctly. If the option is disabled, dm_warn() is compiled
out - it will do nothing when called.
config DM_DEBUG config DM_DEBUG
bool "Enable debug messages in driver model core" bool "Enable debug messages in driver model core"

View File

@ -11,7 +11,7 @@
#include <linux/libfdt.h> #include <linux/libfdt.h>
#include <vsprintf.h> #include <vsprintf.h>
#ifdef CONFIG_DM_WARN #if CONFIG_IS_ENABLED(DM_WARN)
void dm_warn(const char *fmt, ...) void dm_warn(const char *fmt, ...)
{ {
va_list args; va_list args;

View File

@ -16,7 +16,6 @@
#undef CONFIG_DM_SPI #undef CONFIG_DM_SPI
#endif #endif
#undef CONFIG_DM_WARN
#undef CONFIG_DM_STDIO #undef CONFIG_DM_STDIO
#endif /* CONFIG_SPL_BUILD */ #endif /* CONFIG_SPL_BUILD */

View File

@ -6,7 +6,7 @@
#ifndef __DM_UTIL_H #ifndef __DM_UTIL_H
#define __DM_UTIL_H #define __DM_UTIL_H
#ifdef CONFIG_DM_WARN #if CONFIG_IS_ENABLED(DM_WARN)
void dm_warn(const char *fmt, ...); void dm_warn(const char *fmt, ...);
#else #else
static inline void dm_warn(const char *fmt, ...) static inline void dm_warn(const char *fmt, ...)