[PATCH v3 3/5] dynamic_debug: expose printing declarations with the core enabled

From: Zhi Wang

Date: Thu Oct 01 2026 - 11:22:28 EST


The dynamic debug printing functions exist whenever DYNAMIC_DEBUG_CORE is
enabled, even if the current translation unit has not opted in to debug
callsites. Expose their declarations under that same condition.

Rust bindings and helpers are compiled independently of the driver crates
that opt in with DYNAMIC_DEBUG_MODULE. They need the declarations in a
CORE-only configuration without enabling callsites globally. Leave the
existing conditions around the callsite macros unchanged.

Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
---
include/linux/dynamic_debug.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 05743900a116..04df97596a41 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -131,12 +131,7 @@ struct ddebug_class_param {
const struct ddebug_class_map *map;
};

-/*
- * pr_debug() and friends are globally enabled or modules have selectively
- * enabled them.
- */
-#if defined(CONFIG_DYNAMIC_DEBUG) || \
- (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
+#ifdef CONFIG_DYNAMIC_DEBUG_CORE

extern __printf(2, 3)
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
@@ -161,6 +156,15 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
const struct ib_device *ibdev,
const char *fmt, ...);

+#endif /* CONFIG_DYNAMIC_DEBUG_CORE */
+
+/*
+ * pr_debug() and friends are globally enabled or modules have selectively
+ * enabled them.
+ */
+#if defined(CONFIG_DYNAMIC_DEBUG) || \
+ (defined(CONFIG_DYNAMIC_DEBUG_CORE) && defined(DYNAMIC_DEBUG_MODULE))
+
#define __dynamic_dump_stack(desc) \
{ \
if (desc.flags & _DPRINTK_FLAGS_INCL_STACK) \
--
2.53.0