diff mbox series

[RFC,v2,1/4] drm_print.h: rewrap __DRM_DEFINE_DBG_RATELIMITED macro

Message ID 20210711055003.528167-2-jim.cromie@gmail.com (mailing list archive)
State New, archived
Headers show
Series Allow using dyndbg to replace drm_debug_enabled | expand

Commit Message

Jim Cromie July 11, 2021, 5:49 a.m. UTC
whitespace only, to diff-minimize a later commit.
no functional changes
---
 include/drm/drm_print.h | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Comments

Joe Perches July 11, 2021, 4:17 p.m. UTC | #1
On Sat, 2021-07-10 at 23:49 -0600, Jim Cromie wrote:
> whitespace only, to diff-minimize a later commit.
> no functional changes
[]
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
[]
> @@ -524,19 +524,24 @@ void __drm_err(const char *format, ...);
>  #define DRM_DEBUG_DP(fmt, ...)						\
>  	__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
>  
> 
> -#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)					\
> -({												\
> -	static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
> -	const struct drm_device *drm_ = (drm);							\
> -												\
> -	if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))			\
> -		drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);	\
> +#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)		\
> +({									\
> +	static DEFINE_RATELIMIT_STATE(rs_,				\
> +				      DEFAULT_RATELIMIT_INTERVAL,	\
> +				      DEFAULT_RATELIMIT_BURST);		\
> +	const struct drm_device *drm_ = (drm);				\
> +									\
> +	if (drm_debug_enabled(DRM_UT_ ## category)			\
> +	    && __ratelimit(&rs_))					\

Though I don't really see the need for the change, the typical style
has the logical continuation at the end of the test.

	if (drm_debug_enabled(DRM_UT_ ## category) &&			\
	    __ratelimit(&rs_))						\
Jim Cromie July 13, 2021, 1:38 a.m. UTC | #2
On Sun, Jul 11, 2021 at 10:17 AM Joe Perches <joe@perches.com> wrote:
>
> On Sat, 2021-07-10 at 23:49 -0600, Jim Cromie wrote:
> > whitespace only, to diff-minimize a later commit.
> > no functional changes
> []
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> []
> > @@ -524,19 +524,24 @@ void __drm_err(const char *format, ...);
> >  #define DRM_DEBUG_DP(fmt, ...)                                               \
> >       __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
> >
> >
> > -#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)                                        \
> > -({                                                                                           \
> > -     static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
> > -     const struct drm_device *drm_ = (drm);                                                  \
> > -                                                                                             \
> > -     if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))                        \
> > -             drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);       \
> > +#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)                \
> > +({                                                                   \
> > +     static DEFINE_RATELIMIT_STATE(rs_,                              \
> > +                                   DEFAULT_RATELIMIT_INTERVAL,       \
> > +                                   DEFAULT_RATELIMIT_BURST);         \
> > +     const struct drm_device *drm_ = (drm);                          \
> > +                                                                     \
> > +     if (drm_debug_enabled(DRM_UT_ ## category)                      \
> > +         && __ratelimit(&rs_))                                       \
>
> Though I don't really see the need for the change, the typical style
> has the logical continuation at the end of the test.
>

yes I caught that late, old habit, hard to break.
That if-statement is altered as part of HEAD+2
    drm: RFC add choice to use dynamic debug in drm-debug

which replaces drm_dev_printk with drm_dev_dbg
(which calls pr_debug in DRM_USE_DYNAMIC_DEBUG)


>         if (drm_debug_enabled(DRM_UT_ ## category) &&                   \
>             __ratelimit(&rs_))                                          \
>
>
diff mbox series

Patch

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 9b66be54dd16..6419b4e7c5dc 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -524,19 +524,24 @@  void __drm_err(const char *format, ...);
 #define DRM_DEBUG_DP(fmt, ...)						\
 	__drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
 
-#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)					\
-({												\
-	static DEFINE_RATELIMIT_STATE(rs_, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST);\
-	const struct drm_device *drm_ = (drm);							\
-												\
-	if (drm_debug_enabled(DRM_UT_ ## category) && __ratelimit(&rs_))			\
-		drm_dev_printk(drm_ ? drm_->dev : NULL, KERN_DEBUG, fmt, ## __VA_ARGS__);	\
+#define __DRM_DEFINE_DBG_RATELIMITED(category, drm, fmt, ...)		\
+({									\
+	static DEFINE_RATELIMIT_STATE(rs_,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	const struct drm_device *drm_ = (drm);				\
+									\
+	if (drm_debug_enabled(DRM_UT_ ## category)			\
+	    && __ratelimit(&rs_))					\
+		drm_dev_printk(drm_ ? drm_->dev : NULL,			\
+			       KERN_DEBUG, fmt, ## __VA_ARGS__);	\
 })
 
 #define drm_dbg_kms_ratelimited(drm, fmt, ...) \
 	__DRM_DEFINE_DBG_RATELIMITED(KMS, drm, fmt, ## __VA_ARGS__)
 
-#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...) drm_dbg_kms_ratelimited(NULL, fmt, ## __VA_ARGS__)
+#define DRM_DEBUG_KMS_RATELIMITED(fmt, ...) \
+	drm_dbg_kms_ratelimited(NULL, fmt, ## __VA_ARGS__)
 
 /*
  * struct drm_device based WARNs