[Intel-gfx] [RFC 2/6] drm: Introduce unexported DRM_LOG_NAME define for logging
Tvrtko Ursulin
tursulin at ursulin.net
Wed Jan 24 16:18:17 UTC 2018
From: Tvrtko Ursulin <tvrtko.ursulin at 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 at intel.com>
Cc: Daniel Vetter <daniel.vetter at intel.com>
Cc: Gustavo Padovan <gustavo at padovan.org>
Cc: Sean Paul <seanpaul at chromium.org>
Cc: David Airlie <airlied at linux.ie>
Cc: dri-devel at 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 --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? */
--
2.14.1
More information about the Intel-gfx
mailing list