summaryrefslogtreecommitdiffstats
path: root/kernel/debug/kdb/kdb_private.h
diff options
context:
space:
mode:
authorStephen Zhang <stephenzhangzsd@gmail.com>2021-02-04 13:07:09 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2021-02-04 16:55:04 +0100
commit0759d8072843fe621b4d7abb31a7b7bc84ae4159 (patch)
treebc2b11666410527419a8c7dd7465c95fde26fe7c /kernel/debug/kdb/kdb_private.h
parentkernel: debug: fix typo issue (diff)
downloadlinux-0759d8072843fe621b4d7abb31a7b7bc84ae4159.tar.xz
linux-0759d8072843fe621b4d7abb31a7b7bc84ae4159.zip
kdb: kdb_support: Fix debugging information problem
There are several common patterns. 0: kdb_printf("...",...); which is the normal one. 1: kdb_printf("%s: "...,__func__,...) We could improve '1' to this : #define kdb_func_printf(format, args...) \ kdb_printf("%s: " format, __func__, ## args) 2: if(KDB_DEBUG(AR)) kdb_printf("%s "...,__func__,...); We could improve '2' to this : #define kdb_dbg_printf(mask, format, args...) \ do { \ if (KDB_DEBUG(mask)) \ kdb_func_printf(format, ## args); \ } while (0) In addition, we changed the format code of size_t to %zu. Signed-off-by: Stephen Zhang <stephenzhangzsd@gmail.com> Link: https://lore.kernel.org/r/1612440429-6391-1-git-send-email-stephenzhangzsd@gmail.com Reviewed-by: Douglas Anderson <dianders@chromium.org> [daniel.thompson@linaro.org: Minor typo and line length fixes in the patch description] Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Diffstat (limited to 'kernel/debug/kdb/kdb_private.h')
-rw-r--r--kernel/debug/kdb/kdb_private.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h
index a4281fb99299..0a56d35f6eea 100644
--- a/kernel/debug/kdb/kdb_private.h
+++ b/kernel/debug/kdb/kdb_private.h
@@ -254,4 +254,14 @@ extern char kdb_prompt_str[];
#define KDB_WORD_SIZE ((int)sizeof(unsigned long))
#endif /* CONFIG_KGDB_KDB */
+
+#define kdb_func_printf(format, args...) \
+ kdb_printf("%s: " format, __func__, ## args)
+
+#define kdb_dbg_printf(mask, format, args...) \
+ do { \
+ if (KDB_DEBUG(mask)) \
+ kdb_func_printf(format, ## args); \
+ } while (0)
+
#endif /* !_KDBPRIVATE_H */