All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: Sean Paul <seanpaul@chromium.org>
Cc: dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	outreachy-kernel <outreachy-kernel@googlegroups.com>,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH v3 1/2] drm: Move debug macros out of drmP.h
Date: Tue, 17 Oct 2017 14:29:20 -0600	[thread overview]
Message-ID: <20171017202920.GA15615@Haneen> (raw)
In-Reply-To: <20171017195413.rlzmpurlk6cqho2z@art_vandelay>

On Tue, Oct 17, 2017 at 03:54:13PM -0400, Sean Paul wrote:
> On Tue, Oct 17, 2017 at 02:43:38AM -0600, Haneen Mohammed wrote:
> > This patch extract DRM_* debug macros from drmP.h to drm_print.h and
> > move printing related functions used by these macros from drm_drv.[hc]
> > to drm_print.[hc].
> > 
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> > ---
> > Changes in v3:
> > - Move debug macros and print functions into drm_print.[hc] instead of
> > introducing drm_debug.[hc].
> > 
> >  drivers/gpu/drm/drm_drv.c   |  47 -------------
> >  drivers/gpu/drm/drm_print.c |  47 +++++++++++++
> >  include/drm/drmP.h          | 150 +-----------------------------------------
> >  include/drm/drm_drv.h       |   7 --
> >  include/drm/drm_print.h     | 156 ++++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 204 insertions(+), 203 deletions(-)
> > 
> 
> <snip />
> 
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 7277783a..2ba73ff4 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -75,6 +75,7 @@
> >  #include <drm/drm_sarea.h>
> >  #include <drm/drm_drv.h>
> >  #include <drm/drm_prime.h>
> > +#include <drm/drm_print.h>
> >  #include <drm/drm_pci.h>
> >  #include <drm/drm_file.h>
> >  #include <drm/drm_debugfs.h>
> > @@ -142,160 +143,11 @@ struct pci_controller;
> >  /*@{*/
> >  
> 
> Any reason why you didn't move the DRM_UT_* defines as well? They're sprinkled
> through a couple drivers, but it's all related to debug messaging.
> 
> Sean
> 

No, I didn't know they are specifically related to debug messaging.
I will include them then in a revised patch.

Thank you,
Haneen

> >  /***********************************************************************/
> > -/** \name Macros to make printk easier */
> > -/*@{*/
> > -
> > -#define _DRM_PRINTK(once, level, fmt, ...)				\
> > -	do {								\
> > -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > -			     ##__VA_ARGS__);				\
> > -	} while (0)
> > -
> > -#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.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > -		       fmt, ##__VA_ARGS__)
> > -#define DRM_ERROR(fmt, ...)						\
> > -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > -
> > -/**
> > - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -									\
> > -	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, ...)					\
> > -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > -		       ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > -({									\
> > -	static bool __print_once __read_mostly;				\
> > -	if (!__print_once) {						\
> > -		__print_once = true;					\
> > -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > -	}								\
> > -})
> > -
> > -/**
> > - * Debug output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG(fmt, ...)						\
> > -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_KMS(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_PRIME(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_VBL(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > -
> > -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -	if (__ratelimit(&_rs))						\
> > -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > -			       __func__, "", fmt, ##args);		\
> > -})
> > -
> > -/**
> > - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > -
> > -/* Format strings and argument splitters to simplify printing
> > - * various "complex" objects
> > - */
> > -
> > -/*@}*/
> > -
> > -/***********************************************************************/
> >  /** \name Internal types and structures */
> >  /*@{*/
> >  
> >  #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
> >  
> > -
> >  /**
> >   * drm_drv_uses_atomic_modeset - check if the driver implements
> >   * atomic_commit()
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index 71bbaae..4f3cc25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -592,13 +592,6 @@ struct drm_driver {
> >  	int dev_priv_size;
> >  };
> >  
> > -__printf(6, 7)
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...);
> > -__printf(3, 4)
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...);
> >  extern unsigned int drm_debug;
> >  
> >  int drm_dev_init(struct drm_device *dev,
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index ca4d7c6..9dacc5e 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -128,4 +128,160 @@ static inline struct drm_printer drm_debug_printer(const char *prefix)
> >  	};
> >  	return p;
> >  }
> > +
> > +__printf(6, 7)
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...);
> > +__printf(3, 4)
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...);
> > +/***********************************************************************/
> > +/** \name Macros to make printk easier */
> > +/*@{*/
> > +
> > +#define _DRM_PRINTK(once, level, fmt, ...)				\
> > +	do {								\
> > +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > +			     ##__VA_ARGS__);				\
> > +	} while (0)
> > +
> > +#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.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > +		       fmt, ##__VA_ARGS__)
> > +#define DRM_ERROR(fmt, ...)						\
> > +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > +
> > +/**
> > + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +									\
> > +	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, ...)					\
> > +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > +		       ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > +({									\
> > +	static bool __print_once __read_mostly;				\
> > +	if (!__print_once) {						\
> > +		__print_once = true;					\
> > +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > +	}								\
> > +})
> > +
> > +/**
> > + * Debug output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG(fmt, ...)						\
> > +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_KMS(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_PRIME(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_VBL(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > +
> > +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +	if (__ratelimit(&_rs))						\
> > +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > +			       __func__, "", fmt, ##args);		\
> > +})
> > +
> > +/**
> > + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > +
> > +/* Format strings and argument splitters to simplify printing
> > + * various "complex" objects
> > + */
> > +
> > +/*@}*/
> > +
> >  #endif /* DRM_PRINT_H_ */
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS


WARNING: multiple messages have this Message-ID (diff)
From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: Sean Paul <seanpaul@chromium.org>
Cc: gregkh@linuxfoundation.org,
	outreachy-kernel <outreachy-kernel@googlegroups.com>,
	dri-devel@lists.freedesktop.org,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v3 1/2] drm: Move debug macros out of drmP.h
Date: Tue, 17 Oct 2017 14:29:20 -0600	[thread overview]
Message-ID: <20171017202920.GA15615@Haneen> (raw)
In-Reply-To: <20171017195413.rlzmpurlk6cqho2z@art_vandelay>

On Tue, Oct 17, 2017 at 03:54:13PM -0400, Sean Paul wrote:
> On Tue, Oct 17, 2017 at 02:43:38AM -0600, Haneen Mohammed wrote:
> > This patch extract DRM_* debug macros from drmP.h to drm_print.h and
> > move printing related functions used by these macros from drm_drv.[hc]
> > to drm_print.[hc].
> > 
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
> > ---
> > Changes in v3:
> > - Move debug macros and print functions into drm_print.[hc] instead of
> > introducing drm_debug.[hc].
> > 
> >  drivers/gpu/drm/drm_drv.c   |  47 -------------
> >  drivers/gpu/drm/drm_print.c |  47 +++++++++++++
> >  include/drm/drmP.h          | 150 +-----------------------------------------
> >  include/drm/drm_drv.h       |   7 --
> >  include/drm/drm_print.h     | 156 ++++++++++++++++++++++++++++++++++++++++++++
> >  5 files changed, 204 insertions(+), 203 deletions(-)
> > 
> 
> <snip />
> 
> > diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> > index 7277783a..2ba73ff4 100644
> > --- a/include/drm/drmP.h
> > +++ b/include/drm/drmP.h
> > @@ -75,6 +75,7 @@
> >  #include <drm/drm_sarea.h>
> >  #include <drm/drm_drv.h>
> >  #include <drm/drm_prime.h>
> > +#include <drm/drm_print.h>
> >  #include <drm/drm_pci.h>
> >  #include <drm/drm_file.h>
> >  #include <drm/drm_debugfs.h>
> > @@ -142,160 +143,11 @@ struct pci_controller;
> >  /*@{*/
> >  
> 
> Any reason why you didn't move the DRM_UT_* defines as well? They're sprinkled
> through a couple drivers, but it's all related to debug messaging.
> 
> Sean
> 

No, I didn't know they are specifically related to debug messaging.
I will include them then in a revised patch.

Thank you,
Haneen

> >  /***********************************************************************/
> > -/** \name Macros to make printk easier */
> > -/*@{*/
> > -
> > -#define _DRM_PRINTK(once, level, fmt, ...)				\
> > -	do {								\
> > -		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > -			     ##__VA_ARGS__);				\
> > -	} while (0)
> > -
> > -#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.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > -	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > -		       fmt, ##__VA_ARGS__)
> > -#define DRM_ERROR(fmt, ...)						\
> > -	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > -
> > -/**
> > - * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -									\
> > -	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, ...)					\
> > -	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > -		       ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > -({									\
> > -	static bool __print_once __read_mostly;				\
> > -	if (!__print_once) {						\
> > -		__print_once = true;					\
> > -		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > -	}								\
> > -})
> > -
> > -/**
> > - * Debug output.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG(fmt, ...)						\
> > -	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_KMS(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_PRIME(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > -		       fmt, ##args)
> > -#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > -
> > -#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > -	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > -		       ##args)
> > -#define DRM_DEBUG_VBL(fmt, ...)					\
> > -	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > -
> > -#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > -({									\
> > -	static DEFINE_RATELIMIT_STATE(_rs,				\
> > -				      DEFAULT_RATELIMIT_INTERVAL,	\
> > -				      DEFAULT_RATELIMIT_BURST);		\
> > -	if (__ratelimit(&_rs))						\
> > -		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > -			       __func__, "", fmt, ##args);		\
> > -})
> > -
> > -/**
> > - * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > - *
> > - * \param fmt printf() like format string.
> > - * \param arg arguments
> > - */
> > -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > -	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > -#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > -#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > -#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > -	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > -#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > -	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > -
> > -/* Format strings and argument splitters to simplify printing
> > - * various "complex" objects
> > - */
> > -
> > -/*@}*/
> > -
> > -/***********************************************************************/
> >  /** \name Internal types and structures */
> >  /*@{*/
> >  
> >  #define DRM_IF_VERSION(maj, min) (maj << 16 | min)
> >  
> > -
> >  /**
> >   * drm_drv_uses_atomic_modeset - check if the driver implements
> >   * atomic_commit()
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index 71bbaae..4f3cc25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -592,13 +592,6 @@ struct drm_driver {
> >  	int dev_priv_size;
> >  };
> >  
> > -__printf(6, 7)
> > -void drm_dev_printk(const struct device *dev, const char *level,
> > -		    unsigned int category, const char *function_name,
> > -		    const char *prefix, const char *format, ...);
> > -__printf(3, 4)
> > -void drm_printk(const char *level, unsigned int category,
> > -		const char *format, ...);
> >  extern unsigned int drm_debug;
> >  
> >  int drm_dev_init(struct drm_device *dev,
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index ca4d7c6..9dacc5e 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -128,4 +128,160 @@ static inline struct drm_printer drm_debug_printer(const char *prefix)
> >  	};
> >  	return p;
> >  }
> > +
> > +__printf(6, 7)
> > +void drm_dev_printk(const struct device *dev, const char *level,
> > +		    unsigned int category, const char *function_name,
> > +		    const char *prefix, const char *format, ...);
> > +__printf(3, 4)
> > +void drm_printk(const char *level, unsigned int category,
> > +		const char *format, ...);
> > +/***********************************************************************/
> > +/** \name Macros to make printk easier */
> > +/*@{*/
> > +
> > +#define _DRM_PRINTK(once, level, fmt, ...)				\
> > +	do {								\
> > +		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
> > +			     ##__VA_ARGS__);				\
> > +	} while (0)
> > +
> > +#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.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR(dev, fmt, ...)					\
> > +	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
> > +		       fmt, ##__VA_ARGS__)
> > +#define DRM_ERROR(fmt, ...)						\
> > +	drm_printk(KERN_ERR, DRM_UT_NONE, fmt,	##__VA_ARGS__)
> > +
> > +/**
> > + * Rate limited error output.  Like DRM_ERROR() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_ERROR_RATELIMITED(dev, fmt, ...)			\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +									\
> > +	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, ...)					\
> > +	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
> > +		       ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
> > +({									\
> > +	static bool __print_once __read_mostly;				\
> > +	if (!__print_once) {						\
> > +		__print_once = true;					\
> > +		DRM_DEV_INFO(dev, fmt, ##__VA_ARGS__);			\
> > +	}								\
> > +})
> > +
> > +/**
> > + * Debug output.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG(fmt, ...)						\
> > +	drm_printk(KERN_DEBUG, DRM_UT_CORE, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_DRIVER(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_KMS(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_KMS, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_PRIME(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
> > +		       fmt, ##args)
> > +#define DRM_DEBUG_ATOMIC(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
> > +
> > +#define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
> > +	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
> > +		       ##args)
> > +#define DRM_DEBUG_VBL(fmt, ...)					\
> > +	drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > +
> > +#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)	\
> > +({									\
> > +	static DEFINE_RATELIMIT_STATE(_rs,				\
> > +				      DEFAULT_RATELIMIT_INTERVAL,	\
> > +				      DEFAULT_RATELIMIT_BURST);		\
> > +	if (__ratelimit(&_rs))						\
> > +		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
> > +			       __func__, "", fmt, ##args);		\
> > +})
> > +
> > +/**
> > + * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
> > + *
> > + * \param fmt printf() like format string.
> > + * \param arg arguments
> > + */
> > +#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, args...)			\
> > +	DEV__DRM_DEFINE_DEBUG_RATELIMITED(dev, CORE, fmt, ##args)
> > +#define DRM_DEBUG_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_DRIVER_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRIVER, fmt, ##args)
> > +#define DRM_DEBUG_DRIVER_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_DRIVER_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, KMS, fmt, ##args)
> > +#define DRM_DEBUG_KMS_RATELIMITED(fmt, args...)				\
> > +	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##args)
> > +#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, args...)		\
> > +	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, PRIME, fmt, ##args)
> > +#define DRM_DEBUG_PRIME_RATELIMITED(fmt, args...)			\
> > +	DRM_DEV_DEBUG_PRIME_RATELIMITED(NULL, fmt, ##args)
> > +
> > +/* Format strings and argument splitters to simplify printing
> > + * various "complex" objects
> > + */
> > +
> > +/*@}*/
> > +
> >  #endif /* DRM_PRINT_H_ */
> > -- 
> > 2.7.4
> > 
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-10-17 20:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  8:38 [PATCH v3 0/2] drm: Move debug macros out of drmP.h Haneen Mohammed
2017-10-17  8:38 ` Haneen Mohammed
2017-10-17  8:43 ` [PATCH v3 1/2] " Haneen Mohammed
2017-10-17  8:43   ` Haneen Mohammed
2017-10-17 19:54   ` Sean Paul
2017-10-17 19:54     ` Sean Paul
2017-10-17 20:29     ` Haneen Mohammed [this message]
2017-10-17 20:29       ` Haneen Mohammed
2017-10-17  8:45 ` [PATCH v3 2/2] drm/print: Update old comment style Haneen Mohammed
2017-10-17  8:45   ` Haneen Mohammed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171017202920.GA15615@Haneen \
    --to=hamohammed.sa@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.