Message ID | 20250320185238.447458-37-jim.cromie@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix CONFIG_DRM_USE_DYNAMIC_DEBUG=y | expand |
Le 20/03/2025 à 19:52, Jim Cromie a écrit : > dyndbg's CLASSMAP-v1 api was broken; DECLARE_DYNDBG_CLASSMAP tried to > do too much. Its replaced by DRM_CLASSMAP_DEFINE, which creates & > EXPORTs a classmap (in DRM core), and DRM_CLASSMAP_USE which refers to > the classmap defined elsewhere. > > The drivers still use DECLARE_DYNDBG_CLASSMAP for now, so they still > redundantly re-declare the classmap, but we can convert the drivers > later to DYNDBG_CLASSMAP_USE > > Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com> > --- > this ignores a checkpatch > WARNING: Argument 'name' is not used in function-like macro > #70: FILE: include/drm/drm_print.h:148: > +#define DRM_CLASSMAP_USE(name) > > the macro is empty, and correct. only 1 arg is expected. The patch to remove this warning is before, so I think this is not an issue anymore. > --- > drivers/gpu/drm/drm_print.c | 25 +++++++++++++------------ > include/drm/drm_print.h | 8 ++++++++ > 2 files changed, 21 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c > index 79517bd4418f..a3b70d104afa 100644 > --- a/drivers/gpu/drm/drm_print.c > +++ b/drivers/gpu/drm/drm_print.c > @@ -55,18 +55,19 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat > #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) > module_param_named(debug, __drm_debug, ulong, 0600); > #else > -/* classnames must match vals of enum drm_debug_category */ > -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, > - "DRM_UT_CORE", > - "DRM_UT_DRIVER", > - "DRM_UT_KMS", > - "DRM_UT_PRIME", > - "DRM_UT_ATOMIC", > - "DRM_UT_VBL", > - "DRM_UT_STATE", > - "DRM_UT_LEASE", > - "DRM_UT_DP", > - "DRM_UT_DRMRES"); > +/* classnames must match value-symbols of enum drm_debug_category */ > +DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, > + DRM_UT_CORE, > + "DRM_UT_CORE", > + "DRM_UT_DRIVER", > + "DRM_UT_KMS", > + "DRM_UT_PRIME", > + "DRM_UT_ATOMIC", > + "DRM_UT_VBL", > + "DRM_UT_STATE", > + "DRM_UT_LEASE", > + "DRM_UT_DP", > + "DRM_UT_DRMRES"); > > static struct ddebug_class_param drm_debug_bitmap = { > .bits = &__drm_debug, > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h > index 9732f514566d..e86ebb716b4c 100644 > --- a/include/drm/drm_print.h > +++ b/include/drm/drm_print.h > @@ -141,6 +141,14 @@ enum drm_debug_category { > DRM_UT_DRMRES > }; > > +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG > +#define DRM_CLASSMAP_DEFINE(...) DYNAMIC_DEBUG_CLASSMAP_DEFINE(__VA_ARGS__) > +#define DRM_CLASSMAP_USE(name) DYNAMIC_DEBUG_CLASSMAP_USE(name) > +#else > +#define DRM_CLASSMAP_DEFINE(...) > +#define DRM_CLASSMAP_USE(name) > +#endif > + > static inline bool drm_debug_enabled_raw(enum drm_debug_category category) > { > return unlikely(__drm_debug & BIT(category));
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 79517bd4418f..a3b70d104afa 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -55,18 +55,19 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat #if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) module_param_named(debug, __drm_debug, ulong, 0600); #else -/* classnames must match vals of enum drm_debug_category */ -DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0, - "DRM_UT_CORE", - "DRM_UT_DRIVER", - "DRM_UT_KMS", - "DRM_UT_PRIME", - "DRM_UT_ATOMIC", - "DRM_UT_VBL", - "DRM_UT_STATE", - "DRM_UT_LEASE", - "DRM_UT_DP", - "DRM_UT_DRMRES"); +/* classnames must match value-symbols of enum drm_debug_category */ +DRM_CLASSMAP_DEFINE(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, + DRM_UT_CORE, + "DRM_UT_CORE", + "DRM_UT_DRIVER", + "DRM_UT_KMS", + "DRM_UT_PRIME", + "DRM_UT_ATOMIC", + "DRM_UT_VBL", + "DRM_UT_STATE", + "DRM_UT_LEASE", + "DRM_UT_DP", + "DRM_UT_DRMRES"); static struct ddebug_class_param drm_debug_bitmap = { .bits = &__drm_debug, diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 9732f514566d..e86ebb716b4c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -141,6 +141,14 @@ enum drm_debug_category { DRM_UT_DRMRES }; +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +#define DRM_CLASSMAP_DEFINE(...) DYNAMIC_DEBUG_CLASSMAP_DEFINE(__VA_ARGS__) +#define DRM_CLASSMAP_USE(name) DYNAMIC_DEBUG_CLASSMAP_USE(name) +#else +#define DRM_CLASSMAP_DEFINE(...) +#define DRM_CLASSMAP_USE(name) +#endif + static inline bool drm_debug_enabled_raw(enum drm_debug_category category) { return unlikely(__drm_debug & BIT(category));
dyndbg's CLASSMAP-v1 api was broken; DECLARE_DYNDBG_CLASSMAP tried to do too much. Its replaced by DRM_CLASSMAP_DEFINE, which creates & EXPORTs a classmap (in DRM core), and DRM_CLASSMAP_USE which refers to the classmap defined elsewhere. The drivers still use DECLARE_DYNDBG_CLASSMAP for now, so they still redundantly re-declare the classmap, but we can convert the drivers later to DYNDBG_CLASSMAP_USE Signed-off-by: Jim Cromie <jim.cromie@gmail.com> --- this ignores a checkpatch WARNING: Argument 'name' is not used in function-like macro #70: FILE: include/drm/drm_print.h:148: +#define DRM_CLASSMAP_USE(name) the macro is empty, and correct. only 1 arg is expected. --- drivers/gpu/drm/drm_print.c | 25 +++++++++++++------------ include/drm/drm_print.h | 8 ++++++++ 2 files changed, 21 insertions(+), 12 deletions(-)