提交 5176365a 编写于 作者: H Heinrich Schuchardt 提交者: Tom Rini

log: make debug_cond() function like

Change debug_cond() such that it can be used instead of a function like
debug().
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 f5abd8a6
...@@ -217,10 +217,9 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, ...@@ -217,10 +217,9 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
#if !_DEBUG && CONFIG_IS_ENABLED(LOG) #if !_DEBUG && CONFIG_IS_ENABLED(LOG)
#define debug_cond(cond, fmt, args...) \ #define debug_cond(cond, fmt, args...) \
do { \ ({ \
if (1) \
log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \
} while (0) })
#else /* _DEBUG */ #else /* _DEBUG */
...@@ -230,10 +229,10 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level, ...@@ -230,10 +229,10 @@ static inline int _log_nop(enum log_category_t cat, enum log_level_t level,
* optimization. * optimization.
*/ */
#define debug_cond(cond, fmt, args...) \ #define debug_cond(cond, fmt, args...) \
do { \ ({ \
if (cond) \ if (cond) \
printf(pr_fmt(fmt), ##args); \ printf(pr_fmt(fmt), ##args); \
} while (0) })
#endif /* _DEBUG */ #endif /* _DEBUG */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册