Re: [PATCH v1 3/8] drm/print: add new logging helper for drm logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 21 Dec 2019, Sam Ravnborg <sam@xxxxxxxxxxxx> wrote:
> Add new helper so logging can use the standard logging
> functions without an extra helper function.

The main functional change here is that this will no longer print the
function names in the debug logs. I am not sure if we want to make that
change.

BR,
Jani.

>
> Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Cc: Sean Paul <sean@xxxxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> ---
>  include/drm/drm_print.h | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index d2b9ac6a6e18..c1d333bb7534 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -403,10 +403,15 @@ static inline bool drm_debug_enabled(enum drm_debug_category category)
>   * Prefer drm_device based logging over device or printk based logging.
>   */
>  
> -/* Helper for struct drm_device based logging. */
> +/* Helpers for struct drm_device based logging. */
>  #define __drm_printk(drm, level, type, fmt, ...)			\
>  	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
>  
> +#define __drm_cat_printk(drm, cat, fmt, ...)				\
> +({									\
> +	if (drm_debug_enabled(cat))					\
> +		dev_dbg((drm)->dev, "[drm] " fmt, ##__VA_ARGS__);	\
> +})
>  
>  #define drm_info(drm, fmt, ...)						\
>  	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
> @@ -430,24 +435,23 @@ static inline bool drm_debug_enabled(enum drm_debug_category category)
>  	__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
>  
>  #define drm_dbg_core(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_CORE, fmt, ##__VA_ARGS__)
>  #define drm_dbg(drm, fmt, ...)						\
> -	drm_dev_dbg((drm)->dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
>  #define drm_dbg_kms(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_KMS, fmt, ##__VA_ARGS__)
>  #define drm_dbg_prime(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_PRIME, fmt, ##__VA_ARGS__)
>  #define drm_dbg_atomic(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
>  #define drm_dbg_vbl(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_VBL, fmt, ##__VA_ARGS__)
>  #define drm_dbg_state(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_STATE, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_STATE, fmt, ##__VA_ARGS__)
>  #define drm_dbg_lease(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> +	__drm_cat_printk((drm), DRM_UT_LEASE, fmt, ##__VA_ARGS__)
>  #define drm_dbg_dp(drm, fmt, ...)					\
> -	drm_dev_dbg((drm)->dev, DRM_UT_DP, fmt, ##__VA_ARGS__)
> -
> +	__drm_cat_printk((drm), DRM_UT_DP, fmt, ##__VA_ARGS__)
>  
>  /*
>   * LEGACY logging support - do not use in new code

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux