drm/print: Delete a few unused shouting macros
diff mbox series

Message ID 20200214090428.2929833-1-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • drm/print: Delete a few unused shouting macros
Related show

Commit Message

Daniel Vetter Feb. 14, 2020, 9:04 a.m. UTC
We want to go over to the new lowercase ones, encourage that a bit
more.

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_managed.c | 21 +++++++++++++++++++++
 include/drm/drm_print.h       | 26 --------------------------
 2 files changed, 21 insertions(+), 26 deletions(-)

Comments

Jani Nikula Feb. 14, 2020, 9:13 a.m. UTC | #1
On Fri, 14 Feb 2020, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> We want to go over to the new lowercase ones, encourage that a bit
> more.
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_managed.c | 21 +++++++++++++++++++++

Oops?

>  include/drm/drm_print.h       | 26 --------------------------

Acked-by: Jani Nikula <jani.nikula@intel.com>

for this file.

>  2 files changed, 21 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
> index ea49071b16ee..7d4827b79806 100644
> --- a/drivers/gpu/drm/drm_managed.c
> +++ b/drivers/gpu/drm/drm_managed.c
> @@ -38,4 +38,25 @@ struct drmres {
>  	u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];
>  };
>  
> +static __always_inline struct drmres * alloc_dr(drmres_release_t release,
> +						size_t size, gfp_t gfp, int nid)
> +{
> +	size_t tot_size;
> +	struct drmres *dr;
> +
> +	/* We must catch any near-SIZE_MAX cases that could overflow. */
> +	if (unlikely(check_add_overflow(sizeof(*dr), size, &tot_size)))
> +		return NULL;
> +
> +	dr = kmalloc_node_track_caller(tot_size, gfp, nid);
> +	if (unlikely(!dr))
> +		return NULL;
> +
> +	memset(dr, 0, offsetof(struct drmres, data));
> +
> +	INIT_LIST_HEAD(&dr->node.entry);
> +	dr->node.release = release;
> +	return dr;
> +}
> +
>  
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 894a0b9437e2..fd6ba2532f50 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -382,14 +382,6 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>  	drm_dev_dbg(dev, 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_DEV_DEBUG_PRIME(dev, fmt, ...)				\
> -	drm_dev_dbg(dev, 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_DEV_DEBUG_VBL(dev, fmt, ...)				\
> -	drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> -#define	DRM_DEV_DEBUG_DP(dev, fmt, ...)					\
> -	drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__)
>  
>  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)	\
>  ({									\
> @@ -406,18 +398,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
>   * @dev: device pointer
>   * @fmt: printf() like format string.
>   */
> -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, ...)			\
> -	_DEV_DRM_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_CORE,		\
> -					  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_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, ...)			\
>  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_KMS,		\
>  					  fmt, ##__VA_ARGS__)
> -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, ...)			\
> -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,		\
> -					  fmt, ##__VA_ARGS__)
>  
>  /*
>   * struct drm_device based logging
> @@ -541,18 +524,9 @@ void __drm_err(const char *format, ...);
>  	__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__)
> -
>  /*
>   * struct drm_device based WARNs
>   *
Sam Ravnborg Feb. 14, 2020, 2:54 p.m. UTC | #2
Hi Daniel.

On Fri, Feb 14, 2020 at 10:04:28AM +0100, Daniel Vetter wrote:
> We want to go over to the new lowercase ones, encourage that a bit
> more.
Thanks for doing this, one item less on my TODO list now.

> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/drm_managed.c | 21 +++++++++++++++++++++
Ups...

>  include/drm/drm_print.h       | 26 --------------------------
This part is:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>


Could you squash in this patch too?
Is simplifies the RATELIMITED stuff and limit it to what is used.

I can send a separate patch for this if you prefer.

	Sam


diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index fd6ba2532f50..ca7cee8e728a 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -383,25 +383,6 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 #define DRM_DEV_DEBUG_KMS(dev, fmt, ...)				\
 	drm_dev_dbg(dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
 
-#define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)	\
-({									\
-	static DEFINE_RATELIMIT_STATE(_rs,				\
-				      DEFAULT_RATELIMIT_INTERVAL,	\
-				      DEFAULT_RATELIMIT_BURST);		\
-	if (__ratelimit(&_rs))						\
-		drm_dev_dbg(dev, category, fmt, ##__VA_ARGS__);		\
-})
-
-/**
- * Rate limited debug output. Like DRM_DEBUG() but won't flood the log.
- *
- * @dev: device pointer
- * @fmt: printf() like format string.
- */
-#define DRM_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, ...)			\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_KMS,		\
-					  fmt, ##__VA_ARGS__)
-
 /*
  * struct drm_device based logging
  *
@@ -525,7 +506,13 @@ void __drm_err(const char *format, ...);
 
 
 #define DRM_DEBUG_KMS_RATELIMITED(fmt, ...)				\
-	DRM_DEV_DEBUG_KMS_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
+({									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,       \
+				      DEFAULT_RATELIMIT_BURST);         \
+	if (__ratelimit(&_rs))						\
+		drm_dev_dbg(NULL, DRM_UT_KMS, fmt, ##__VA_ARGS__);	\
+})
 
 /*
  * struct drm_device based WARNs
Daniel Vetter Feb. 14, 2020, 4:25 p.m. UTC | #3
On Fri, Feb 14, 2020 at 11:13:23AM +0200, Jani Nikula wrote:
> On Fri, 14 Feb 2020, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > We want to go over to the new lowercase ones, encourage that a bit
> > more.
> >
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/drm_managed.c | 21 +++++++++++++++++++++
> 
> Oops?

Indeed, tiny sneak peek at what I'm working on ... you mentioning devm_
yesterday was a very successful nerd snipe :-)

> 
> >  include/drm/drm_print.h       | 26 --------------------------
> 
> Acked-by: Jani Nikula <jani.nikula@intel.com>
> 
> for this file.

Wrong hunk dropped and applied, thanks for taking a look.
-Daniel

> 
> >  2 files changed, 21 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
> > index ea49071b16ee..7d4827b79806 100644
> > --- a/drivers/gpu/drm/drm_managed.c
> > +++ b/drivers/gpu/drm/drm_managed.c
> > @@ -38,4 +38,25 @@ struct drmres {
> >  	u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];
> >  };
> >  
> > +static __always_inline struct drmres * alloc_dr(drmres_release_t release,
> > +						size_t size, gfp_t gfp, int nid)
> > +{
> > +	size_t tot_size;
> > +	struct drmres *dr;
> > +
> > +	/* We must catch any near-SIZE_MAX cases that could overflow. */
> > +	if (unlikely(check_add_overflow(sizeof(*dr), size, &tot_size)))
> > +		return NULL;
> > +
> > +	dr = kmalloc_node_track_caller(tot_size, gfp, nid);
> > +	if (unlikely(!dr))
> > +		return NULL;
> > +
> > +	memset(dr, 0, offsetof(struct drmres, data));
> > +
> > +	INIT_LIST_HEAD(&dr->node.entry);
> > +	dr->node.release = release;
> > +	return dr;
> > +}
> > +
> >  
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index 894a0b9437e2..fd6ba2532f50 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -382,14 +382,6 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> >  	drm_dev_dbg(dev, 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_DEV_DEBUG_PRIME(dev, fmt, ...)				\
> > -	drm_dev_dbg(dev, 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_DEV_DEBUG_VBL(dev, fmt, ...)				\
> > -	drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
> > -#define	DRM_DEV_DEBUG_DP(dev, fmt, ...)					\
> > -	drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__)
> >  
> >  #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)	\
> >  ({									\
> > @@ -406,18 +398,9 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
> >   * @dev: device pointer
> >   * @fmt: printf() like format string.
> >   */
> > -#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, ...)			\
> > -	_DEV_DRM_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_CORE,		\
> > -					  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_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, ...)			\
> >  	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_KMS,		\
> >  					  fmt, ##__VA_ARGS__)
> > -#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, ...)			\
> > -	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,		\
> > -					  fmt, ##__VA_ARGS__)
> >  
> >  /*
> >   * struct drm_device based logging
> > @@ -541,18 +524,9 @@ void __drm_err(const char *format, ...);
> >  	__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__)
> > -
> >  /*
> >   * struct drm_device based WARNs
> >   *
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center

Patch
diff mbox series

diff --git a/drivers/gpu/drm/drm_managed.c b/drivers/gpu/drm/drm_managed.c
index ea49071b16ee..7d4827b79806 100644
--- a/drivers/gpu/drm/drm_managed.c
+++ b/drivers/gpu/drm/drm_managed.c
@@ -38,4 +38,25 @@  struct drmres {
 	u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];
 };
 
+static __always_inline struct drmres * alloc_dr(drmres_release_t release,
+						size_t size, gfp_t gfp, int nid)
+{
+	size_t tot_size;
+	struct drmres *dr;
+
+	/* We must catch any near-SIZE_MAX cases that could overflow. */
+	if (unlikely(check_add_overflow(sizeof(*dr), size, &tot_size)))
+		return NULL;
+
+	dr = kmalloc_node_track_caller(tot_size, gfp, nid);
+	if (unlikely(!dr))
+		return NULL;
+
+	memset(dr, 0, offsetof(struct drmres, data));
+
+	INIT_LIST_HEAD(&dr->node.entry);
+	dr->node.release = release;
+	return dr;
+}
+
 
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 894a0b9437e2..fd6ba2532f50 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -382,14 +382,6 @@  void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 	drm_dev_dbg(dev, 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_DEV_DEBUG_PRIME(dev, fmt, ...)				\
-	drm_dev_dbg(dev, 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_DEV_DEBUG_VBL(dev, fmt, ...)				\
-	drm_dev_dbg(dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
-#define	DRM_DEV_DEBUG_DP(dev, fmt, ...)					\
-	drm_dev_dbg(dev, DRM_UT_DP, fmt, ## __VA_ARGS__)
 
 #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, category, fmt, ...)	\
 ({									\
@@ -406,18 +398,9 @@  void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
  * @dev: device pointer
  * @fmt: printf() like format string.
  */
-#define DRM_DEV_DEBUG_RATELIMITED(dev, fmt, ...)			\
-	_DEV_DRM_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_CORE,		\
-					  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_DEV_DEBUG_KMS_RATELIMITED(dev, fmt, ...)			\
 	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_KMS,		\
 					  fmt, ##__VA_ARGS__)
-#define DRM_DEV_DEBUG_PRIME_RATELIMITED(dev, fmt, ...)			\
-	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,		\
-					  fmt, ##__VA_ARGS__)
 
 /*
  * struct drm_device based logging
@@ -541,18 +524,9 @@  void __drm_err(const char *format, ...);
 	__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__)
-
 /*
  * struct drm_device based WARNs
  *