dri-devel Archive on lore.kernel.org
 help / color / Atom feed
* drm/print: clean up RATELIMITED macros
@ 2020-02-14 17:59 Sam Ravnborg
  2020-02-15 12:23 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2020-02-14 17:59 UTC (permalink / raw)
  To: dri-devel, Jani Nikula, Daniel Vetter; +Cc: sam

From 6fdc9c030ba88e6d0d8abc319f3dfe83751d5900 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 14 Feb 2020 18:54:42 +0100
Subject: [PATCH v1 1/1] drm/print: clean up RATELIMITED macros

Drop a few indirections, making the code simpler.
This also drops a RATELIMITED variant that is not in use.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
---
 include/drm/drm_print.h | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

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
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drm/print: clean up RATELIMITED macros
  2020-02-14 17:59 drm/print: clean up RATELIMITED macros Sam Ravnborg
@ 2020-02-15 12:23 ` Daniel Vetter
  2020-02-15 13:42   ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2020-02-15 12:23 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Jani Nikula, Daniel Vetter, dri-devel

On Fri, Feb 14, 2020 at 06:59:19PM +0100, Sam Ravnborg wrote:
> From 6fdc9c030ba88e6d0d8abc319f3dfe83751d5900 Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Fri, 14 Feb 2020 18:54:42 +0100
> Subject: [PATCH v1 1/1] drm/print: clean up RATELIMITED macros
> 
> Drop a few indirections, making the code simpler.
> This also drops a RATELIMITED variant that is not in use.
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>

Lots of turtles here :-)

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  include/drm/drm_print.h | 27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
> 
> 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
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: drm/print: clean up RATELIMITED macros
  2020-02-15 12:23 ` Daniel Vetter
@ 2020-02-15 13:42   ` Sam Ravnborg
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Ravnborg @ 2020-02-15 13:42 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Jani Nikula, Daniel Vetter, dri-devel

Hi Daniel.

On Sat, Feb 15, 2020 at 01:23:10PM +0100, Daniel Vetter wrote:
> On Fri, Feb 14, 2020 at 06:59:19PM +0100, Sam Ravnborg wrote:
> > From 6fdc9c030ba88e6d0d8abc319f3dfe83751d5900 Mon Sep 17 00:00:00 2001
> > From: Sam Ravnborg <sam@ravnborg.org>
> > Date: Fri, 14 Feb 2020 18:54:42 +0100
> > Subject: [PATCH v1 1/1] drm/print: clean up RATELIMITED macros
> > 
> > Drop a few indirections, making the code simpler.
> > This also drops a RATELIMITED variant that is not in use.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Daniel Vetter <daniel.vetter@intel.com>
> 
> Lots of turtles here :-)

Well, by small steps we may have this readable at one point in time.

> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Thanks, applied to drm-misc-next.

	Sam
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 17:59 drm/print: clean up RATELIMITED macros Sam Ravnborg
2020-02-15 12:23 ` Daniel Vetter
2020-02-15 13:42   ` Sam Ravnborg

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git