[PATCH] include: linux/printk.h: allow forcing log level per file

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Feb 5 09:11:43 PST 2026


We support defining DEBUG or VERBOSE_DEBUG to increase the log level per
file, but we lack a way to decrease the log level.

The latter could be useful when shotgun debugging with all debug logging
enabled, as otherwise some debug output may drown out everything else.

To support this, allow LOGLEVEL to be defined per file. We don't expect
that any files committed to tree would do this, but it may turn out to
be useful during debugging.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/linux/printk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 0d7180f0ebbc..b9b3ddeb4d39 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -22,7 +22,7 @@
 #define LOGLEVEL	MSG_VDEBUG
 #elif defined DEBUG
 #define LOGLEVEL	MSG_DEBUG
-#else
+#elif !defined(LOGLEVEL)
 #define LOGLEVEL	CONFIG_COMPILE_LOGLEVEL
 #endif
 
-- 
2.47.3




More information about the barebox mailing list