Skip to content

Commit e820f52

Browse files
jimcgregkh
authored andcommitted
drm_print: interpose drm_*dbg with forwarding macros
change drm_dev_dbg & drm_dbg to macros, which forward to the renamed functions (with __ prefix added). Those functions sit below the categorized layer of macros implementing the DRM debug.category API, and implement most of it. These are good places to insert dynamic-debug jump-label mechanics, which will allow DRM to avoid the runtime cost of drm_debug_enabled(). no functional changes. memory cost baseline: (unchanged) bash-5.1# drms_load [ 9.220389] dyndbg: 1 debug prints in module drm [ 9.224426] ACPI: bus type drm_connector registered [ 9.302192] dyndbg: 2 debug prints in module ttm [ 9.305033] dyndbg: 8 debug prints in module video [ 9.627563] dyndbg: 127 debug prints in module i915 [ 9.721505] AMD-Vi: AMD IOMMUv2 functionality not available on this system - This is not a bug. [ 10.091345] dyndbg: 2196 debug prints in module amdgpu [ 10.106589] [drm] amdgpu kernel modesetting enabled. [ 10.107270] amdgpu: CRAT table not found [ 10.107926] amdgpu: Virtual CRAT table created for CPU [ 10.108398] amdgpu: Topology: Add CPU node [ 10.168507] dyndbg: 3 debug prints in module wmi [ 10.329587] dyndbg: 3 debug prints in module nouveau Signed-off-by: Jim Cromie <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f158936 commit e820f52

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

drivers/gpu/drm/drm_print.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ void drm_dev_printk(const struct device *dev, const char *level,
279279
}
280280
EXPORT_SYMBOL(drm_dev_printk);
281281

282-
void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
283-
const char *format, ...)
282+
void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
283+
const char *format, ...)
284284
{
285285
struct va_format vaf;
286286
va_list args;
@@ -301,9 +301,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
301301

302302
va_end(args);
303303
}
304-
EXPORT_SYMBOL(drm_dev_dbg);
304+
EXPORT_SYMBOL(__drm_dev_dbg);
305305

306-
void __drm_dbg(enum drm_debug_category category, const char *format, ...)
306+
void ___drm_dbg(enum drm_debug_category category, const char *format, ...)
307307
{
308308
struct va_format vaf;
309309
va_list args;
@@ -320,7 +320,7 @@ void __drm_dbg(enum drm_debug_category category, const char *format, ...)
320320

321321
va_end(args);
322322
}
323-
EXPORT_SYMBOL(__drm_dbg);
323+
EXPORT_SYMBOL(___drm_dbg);
324324

325325
void __drm_err(const char *format, ...)
326326
{

include/drm/drm_print.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ __printf(3, 4)
335335
void drm_dev_printk(const struct device *dev, const char *level,
336336
const char *format, ...);
337337
__printf(3, 4)
338-
void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
338+
void __drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
339339
const char *format, ...);
340340

341341
/**
@@ -384,6 +384,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
384384
} \
385385
})
386386

387+
#define drm_dev_dbg(dev, cat, fmt, ...) \
388+
__drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__)
389+
387390
/**
388391
* DRM_DEV_DEBUG() - Debug output for generic drm code
389392
*
@@ -485,10 +488,12 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
485488
*/
486489

487490
__printf(2, 3)
488-
void __drm_dbg(enum drm_debug_category category, const char *format, ...);
491+
void ___drm_dbg(enum drm_debug_category category, const char *format, ...);
489492
__printf(1, 2)
490493
void __drm_err(const char *format, ...);
491494

495+
#define __drm_dbg(fmt, ...) ___drm_dbg(fmt, ##__VA_ARGS__)
496+
492497
/* Macros to make printk easier */
493498

494499
#define _DRM_PRINTK(once, level, fmt, ...) \

0 commit comments

Comments
 (0)