aboutsummaryrefslogtreecommitdiff
path: root/include/log.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-26 16:17:28 +1300
committerSimon Glass <sjg@chromium.org>2021-04-06 16:33:19 +1200
commit4ce5b8104a1f09c41c69d17f21d9aac567173312 (patch)
tree8339b97edc41eef53a4238e689dfdfa02f6df61a /include/log.h
parentda393412234a37af68188e7490eba136c832a275 (diff)
downloadu-boot-4ce5b8104a1f09c41c69d17f21d9aac567173312.zip
u-boot-4ce5b8104a1f09c41c69d17f21d9aac567173312.tar.gz
u-boot-4ce5b8104a1f09c41c69d17f21d9aac567173312.tar.bz2
log: Fix up debug_cond() when LOG is enabled
At present debug() statements can cause debuf output to appear when LOG is enabled but DEBUG is not. This is not intended and it seems that the condition is wrong. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/log.h')
-rw-r--r--include/log.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/log.h b/include/log.h
index 6ef891d..add3a1e 100644
--- a/include/log.h
+++ b/include/log.h
@@ -222,11 +222,14 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
#define _SPL_BUILD 0
#endif
-#if !_DEBUG && CONFIG_IS_ENABLED(LOG)
+#if CONFIG_IS_ENABLED(LOG)
-#define debug_cond(cond, fmt, args...) \
-({ \
- log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
+#define debug_cond(cond, fmt, args...) \
+({ \
+ if (cond) \
+ log(LOG_CATEGORY, \
+ (enum log_level_t)(LOGL_FORCE_DEBUG | _LOG_DEBUG), \
+ fmt, ##args); \
})
#else /* _DEBUG */