Re: [PATCH RESEND 7/8] drm/print: group logging functions by prink or device based

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

 



On Mon, Oct 28, 2019 at 12:38:21PM +0200, Jani Nikula wrote:
> In preparation for adding struct drm_device based logging, group the
> existing functions by prink or struct device based logging. No
> functional changes.
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  include/drm/drm_print.h | 135 ++++++++++++++++++++++------------------
>  1 file changed, 74 insertions(+), 61 deletions(-)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 13f65394376e..085a9685270c 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -320,6 +320,10 @@ static inline bool drm_debug_enabled(enum drm_debug_category category)
>  	return unlikely(__drm_debug & category);
>  }
>  
> +/*
> + * struct device based logging
> + */
> +
>  __printf(3, 4)
>  void drm_dev_printk(const struct device *dev, const char *level,
>  		    const char *format, ...);
> @@ -327,30 +331,6 @@ __printf(3, 4)
>  void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>  		 const char *format, ...);
>  
> -__printf(2, 3)
> -void __drm_dbg(enum drm_debug_category category, const char *format, ...);
> -__printf(1, 2)
> -void __drm_err(const char *format, ...);
> -
> -/* Macros to make printk easier */
> -
> -#define _DRM_PRINTK(once, level, fmt, ...)				\
> -	printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO(fmt, ...)						\
> -	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE(fmt, ...)						\
> -	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN(fmt, ...)						\
> -	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> -
> -#define DRM_INFO_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> -#define DRM_NOTE_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> -#define DRM_WARN_ONCE(fmt, ...)						\
> -	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> -
>  /**
>   * Error output.
>   *
> @@ -359,8 +339,6 @@ void __drm_err(const char *format, ...);
>   */
>  #define DRM_DEV_ERROR(dev, fmt, ...)					\
>  	drm_dev_printk(dev, KERN_ERR, "*ERROR* " fmt, ##__VA_ARGS__)
> -#define DRM_ERROR(fmt, ...)						\
> -	__drm_err(fmt, ##__VA_ARGS__)
>  
>  /**
>   * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> @@ -377,10 +355,8 @@ void __drm_err(const char *format, ...);
>  	if (__ratelimit(&_rs))						\
>  		DRM_DEV_ERROR(dev, fmt, ##__VA_ARGS__);			\
>  })
> -#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> -	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
>  
> -#define DRM_DEV_INFO(dev, fmt, ...)					\
> +#define DRM_DEV_INFO(dev, fmt, ...)				\

I believe you could skip this chunk...

other than this:
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>

>  	drm_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
>  
>  #define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> @@ -400,41 +376,18 @@ void __drm_err(const char *format, ...);
>   */
>  #define DRM_DEV_DEBUG(dev, fmt, ...)					\
>  	drm_dev_dbg(dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG(fmt, ...)						\
> -	__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_DRIVER(dev, fmt, ...)				\
>  	drm_dev_dbg(dev, DRM_UT_DRIVER,	fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> -	__drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)				\
>  	drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_KMS(fmt, ...)						\
> -	__drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_PRIME(dev, fmt, ...)				\
>  	drm_dev_dbg(dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_PRIME(fmt, ...)					\
> -	__drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, ...)				\
>  	drm_dev_dbg(dev, DRM_UT_ATOMIC,	fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> -	__drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_VBL(dev, fmt, ...)				\
>  	drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_VBL(fmt, ...)						\
> -	__drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -
> -#define DRM_DEBUG_LEASE(fmt, ...)					\
> -	__drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> -
>  #define	DRM_DEV_DEBUG_DP(dev, fmt, ...)					\
>  	drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__)
> -#define DRM_DEBUG_DP(fmt, ...)						\
> -	__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
>  
>  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)	\
>  ({									\
> @@ -454,24 +407,84 @@ void __drm_err(const char *format, ...);
>  #define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, ...)			\
>  	_DEV_DRM_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_CORE,		\
>  					  fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_RATELIMITED(fmt, ...)					\
> -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, ...)			\
>  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_DRIVER,		\
>  					  fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, ...)				\
> -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, ...)			\
>  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_KMS,		\
>  					  fmt, ##__VA_ARGS__)
> -#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...)				\
> -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> -
>  #define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, ...)			\
>  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,		\
>  					  fmt, ##__VA_ARGS__)
> +
> +/*
> + * printk based logging
> + */
> +
> +__printf(2, 3)
> +void __drm_dbg(enum drm_debug_category category, const char *format, ...);
> +__printf(1, 2)
> +void __drm_err(const char *format, ...);
> +
> +/* Macros to make printk easier */
> +
> +#define _DRM_PRINTK(once, level, fmt, ...)				\
> +	printk##once(KERN_##level "[" DRM_NAME "] " fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO(fmt, ...)						\
> +	_DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE(fmt, ...)						\
> +	_DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN(fmt, ...)						\
> +	_DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_INFO_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__)
> +#define DRM_NOTE_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__)
> +#define DRM_WARN_ONCE(fmt, ...)						\
> +	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
> +
> +#define DRM_ERROR(fmt, ...)						\
> +	__drm_err(fmt, ##__VA_ARGS__)
> +
> +#define DRM_ERROR_RATELIMITED(fmt, ...)					\
> +	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG(fmt, ...)						\
> +	__drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> +	__drm_dbg(DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_KMS(fmt, ...)						\
> +	__drm_dbg(DRM_UT_KMS, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_PRIME(fmt, ...)					\
> +	__drm_dbg(DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> +	__drm_dbg(DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_VBL(fmt, ...)						\
> +	__drm_dbg(DRM_UT_VBL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_LEASE(fmt, ...)					\
> +	__drm_dbg(DRM_UT_LEASE, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_DP(fmt, ...)						\
> +	__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
> +
> +
> +#define DRM_DEBUG_RATELIMITED(fmt, ...)					\
> +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, ...)				\
> +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
> +#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...)				\
> +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
> +
>  #define DRM_DEBUG_PRIME_RATELIMITED(fmt, ...)				\
>  	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
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