[PATCH 08/63] dyndbg: drop NUM_TYPE_ARRAY

Jim Cromie posted 63 patches 1 year ago
There is a newer version of this series
[PATCH 08/63] dyndbg: drop NUM_TYPE_ARRAY
Posted by Jim Cromie 1 year ago
ARRAY_SIZE works here, since array decl is complete.

no functional change

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 include/linux/dynamic_debug.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 2b0057058ecf..e458d4b838ac 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -106,11 +106,9 @@ struct ddebug_class_map {
 		.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))
 
 /* encapsulate linker provided built-in (or module) dyndbg data */
 struct _ddebug_info {
-- 
2.48.1
Re: [PATCH 08/63] dyndbg: drop NUM_TYPE_ARRAY
Posted by Louis Chauvet 11 months, 2 weeks ago

Le 25/01/2025 à 07:45, Jim Cromie a écrit :
> ARRAY_SIZE works here, since array decl is complete.
> 
> no functional change
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>

Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>

> ---
>   include/linux/dynamic_debug.h | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
> index 2b0057058ecf..e458d4b838ac 100644
> --- a/include/linux/dynamic_debug.h
> +++ b/include/linux/dynamic_debug.h
> @@ -106,11 +106,9 @@ struct ddebug_class_map {
>   		.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))
>   
>   /* encapsulate linker provided built-in (or module) dyndbg data */
>   struct _ddebug_info {

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com