diff mbox

[RFC,2/6] drm: Introduce unexported DRM_LOG_NAME define for logging

Message ID 20180124161821.28780-3-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tvrtko Ursulin Jan. 24, 2018, 4:18 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Instead of having DRM_NAME which is defined in the uAPI headers used for
kernel log prefix messages, introduct a new DRM_LOG_NAME define defined
privately in kernel space.

Leave the DRM_NAME around, but mark it as obsolete in case there is some
userspace code depending on its presence.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/drm_print.c     | 6 +++---
 drivers/gpu/drm/i915/i915_drv.c | 2 +-
 include/drm/drm_print.h         | 9 ++++++++-
 include/uapi/drm/drm.h          | 2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 781518fd88e3..27244f11c9a3 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -38,7 +38,7 @@  EXPORT_SYMBOL(__drm_printfn_seq_file);
 
 void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
 {
-	dev_info(p->arg, "[" DRM_NAME "] %pV", vaf);
+	dev_info(p->arg, "[" DRM_LOG_NAME "] %pV", vaf);
 }
 EXPORT_SYMBOL(__drm_printfn_info);
 
@@ -63,7 +63,7 @@  void drm_printf(struct drm_printer *p, const char *f, ...)
 }
 EXPORT_SYMBOL(drm_printf);
 
-#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
+#define DRM_PRINTK_FMT "[" DRM_LOG_NAME ":%s]%s %pV"
 
 void drm_dev_printk(const struct device *dev, const char *level,
 		    unsigned int category, const char *function_name,
@@ -102,7 +102,7 @@  void drm_printk(const char *level, unsigned int category,
 	vaf.fmt = format;
 	vaf.va = &args;
 
-	printk("%s" "[" DRM_NAME ":%ps]%s %pV",
+	printk("%s" "[" DRM_LOG_NAME ":%ps]%s %pV",
 	       level, __builtin_return_address(0),
 	       strcmp(level, KERN_ERR) == 0 ? " *ERROR*" : "", &vaf);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 1fbe37889d92..915e43aacaa5 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -94,7 +94,7 @@  __i915_printk(struct drm_i915_private *dev_priv, const char *level,
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	dev_printk(level, kdev, "[" DRM_NAME ":%ps] %pV",
+	dev_printk(level, kdev, "[" DRM_LOG_NAME ":%ps] %pV",
 		   __builtin_return_address(0), &vaf);
 
 	if (is_error && !shown_bug_once) {
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 2a4a42e59a47..d6901128faf2 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -60,6 +60,13 @@ 
  *     }
  */
 
+/**
+ * String output in log messages - can be overriden by driver code.
+ */
+#ifndef DRM_LOG_NAME
+#define DRM_LOG_NAME "drm"
+#endif
+
 /**
  * struct drm_printer - drm output "stream"
  *
@@ -208,7 +215,7 @@  void drm_printk(const char *level, unsigned int category,
 
 #define _DRM_PRINTK(once, level, fmt, ...)				\
 	do {								\
-		printk##once(KERN_##level "[" DRM_NAME "] " fmt,	\
+		printk##once(KERN_##level "[" DRM_LOG_NAME "] " fmt,	\
 			     ##__VA_ARGS__);				\
 	} while (0)
 
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index 6fdff5945c8a..7b512673c220 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -69,7 +69,7 @@  typedef unsigned long drm_handle_t;
 extern "C" {
 #endif
 
-#define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
+#define DRM_NAME	"drm"	  /**< Deprecated. */
 #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
 #define DRM_MAX_ORDER	22	  /**< Up to 2^22 bytes = 4MB */
 #define DRM_RAM_PERCENT 10	  /**< How much system ram can we lock? */