diff mbox series

[v1,2/8] drm/print: move new style logging functions

Message ID 20191221095553.13332-3-sam@ravnborg.org (mailing list archive)
State New, archived
Headers show
Series drm: add more new-style logging functions | expand

Commit Message

Sam Ravnborg Dec. 21, 2019, 9:55 a.m. UTC
Move the new style logging function up right after the documentation of
their usage.
And note that remaining logging functions are legacy.

While moving, drop some extra lines.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 include/drm/drm_print.h | 117 +++++++++++++++++++---------------------
 1 file changed, 56 insertions(+), 61 deletions(-)
diff mbox series

Patch

diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index e9e31ace0afa..d2b9ac6a6e18 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -397,6 +397,62 @@  static inline bool drm_debug_enabled(enum drm_debug_category category)
 	return unlikely(__drm_debug & category);
 }
 
+/*
+ * struct drm_device based logging
+ *
+ * Prefer drm_device based logging over device or printk based logging.
+ */
+
+/* Helper for struct drm_device based logging. */
+#define __drm_printk(drm, level, type, fmt, ...)			\
+	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
+
+
+#define drm_info(drm, fmt, ...)						\
+	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
+#define drm_notice(drm, fmt, ...)					\
+	__drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
+#define drm_warn(drm, fmt, ...)						\
+	__drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
+#define drm_err(drm, fmt, ...)						\
+	__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
+
+#define drm_info_once(drm, fmt, ...)					\
+	__drm_printk((drm), info, _once, fmt, ##__VA_ARGS__)
+#define drm_notice_once(drm, fmt, ...)					\
+	__drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__)
+#define drm_warn_once(drm, fmt, ...)					\
+	__drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__)
+#define drm_err_once(drm, fmt, ...)					\
+	__drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
+
+#define drm_err_ratelimited(drm, fmt, ...)				\
+	__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
+
+#define drm_dbg_core(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
+#define drm_dbg(drm, fmt, ...)						\
+	drm_dev_dbg((drm)->dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
+#define drm_dbg_kms(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
+#define drm_dbg_prime(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
+#define drm_dbg_atomic(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
+#define drm_dbg_vbl(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
+#define drm_dbg_state(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_STATE, fmt, ##__VA_ARGS__)
+#define drm_dbg_lease(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
+#define drm_dbg_dp(drm, fmt, ...)					\
+	drm_dev_dbg((drm)->dev, DRM_UT_DP, fmt, ##__VA_ARGS__)
+
+
+/*
+ * LEGACY logging support - do not use in new code
+ */
+
 /*
  * struct device based logging
  *
@@ -496,67 +552,6 @@  void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 	_DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, DRM_UT_PRIME,		\
 					  fmt, ##__VA_ARGS__)
 
-/*
- * struct drm_device based logging
- *
- * Prefer drm_device based logging over device or prink based logging.
- */
-
-/* Helper for struct drm_device based logging. */
-#define __drm_printk(drm, level, type, fmt, ...)			\
-	dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__)
-
-
-#define drm_info(drm, fmt, ...)					\
-	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
-
-#define drm_notice(drm, fmt, ...)				\
-	__drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
-
-#define drm_warn(drm, fmt, ...)					\
-	__drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
-
-#define drm_err(drm, fmt, ...)					\
-	__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
-
-
-#define drm_info_once(drm, fmt, ...)				\
-	__drm_printk((drm), info, _once, fmt, ##__VA_ARGS__)
-
-#define drm_notice_once(drm, fmt, ...)				\
-	__drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__)
-
-#define drm_warn_once(drm, fmt, ...)				\
-	__drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__)
-
-#define drm_err_once(drm, fmt, ...)				\
-	__drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__)
-
-
-#define drm_err_ratelimited(drm, fmt, ...)				\
-	__drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__)
-
-
-#define drm_dbg_core(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_CORE, fmt, ##__VA_ARGS__)
-#define drm_dbg(drm, fmt, ...)						\
-	drm_dev_dbg((drm)->dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
-#define drm_dbg_kms(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__)
-#define drm_dbg_prime(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__)
-#define drm_dbg_atomic(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__)
-#define drm_dbg_vbl(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_VBL, fmt, ##__VA_ARGS__)
-#define drm_dbg_state(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_STATE, fmt, ##__VA_ARGS__)
-#define drm_dbg_lease(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
-#define drm_dbg_dp(drm, fmt, ...)					\
-	drm_dev_dbg((drm)->dev, DRM_UT_DP, fmt, ##__VA_ARGS__)
-
-
 /*
  * printk based logging
  *