[PATCH v2 12/24] dyndbg: drop NUM_TYPE_ARGS
From: Jim Cromie
Date: Sat May 23 2026 - 03:16:28 EST
ARRAY_SIZE works here, since array decl is complete.
no functional change
Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
Reviewed-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
---
v2: include linux/array_size.h, correct commit subject
review after sob
---
include/linux/dynamic_debug.h | 4 +---
lib/dynamic_debug.c | 1 +
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index aa45dcf36a44..e724f6b93663 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -121,11 +121,9 @@ struct ddebug_class_param {
.mod_name = KBUILD_MODNAME, \
.base = _base, \
.map_type = _maptype, \
- .length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \
+ .length = ARRAY_SIZE(_var##_classnames), \
.class_names = _var##_classnames, \
}
-#define NUM_TYPE_ARGS(eltype, ...) \
- (sizeof((eltype[]) {__VA_ARGS__}) / sizeof(eltype))
extern __printf(2, 3)
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 0377d9f8dcd1..6d9dbeb68ae8 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -13,6 +13,7 @@
#define pr_fmt(fmt) "dyndbg: " fmt
+#include <linux/array_size.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
--
2.54.0