[RFC 3/5] drm: Respect driver set DRM_NAME in drm_dev_printk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

Same as the previous patch did for drm_printk, allow for the
logging macros to pass in the driver set DRM_NAME.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
 drivers/gpu/drm/drm_drv.c       | 14 +++++++-------
 drivers/gpu/drm/i915/i915_drv.c |  3 ++-
 include/drm/drmP.h              | 36 ++++++++++++++++++------------------
 include/drm/drm_drv.h           |  7 ++++---
 4 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index f6b674b03db9..a2f4eb4509b9 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -65,11 +65,10 @@ static struct idr drm_minors_idr;
 
 static struct dentry *drm_debugfs_root;
 
-#define DRM_PRINTK_FMT "[" DRM_NAME ":%s]%s %pV"
-
 void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...)
+		    unsigned int category, const char *driver,
+		    const char *function_name, const char *prefix,
+		    const char *format, ...)
 {
 	struct va_format vaf;
 	va_list args;
@@ -82,10 +81,11 @@ void drm_dev_printk(const struct device *dev, const char *level,
 	vaf.va = &args;
 
 	if (dev)
-		dev_printk(level, dev, DRM_PRINTK_FMT, function_name, prefix,
-			   &vaf);
+		dev_printk(level, dev, "[%s:%ps]%s %pV",
+			   driver, function_name, prefix, &vaf);
 	else
-		printk("%s" DRM_PRINTK_FMT, level, function_name, prefix, &vaf);
+		printk("%s[%s:%ps]%s %pV",
+		       level, driver, function_name, prefix, &vaf);
 
 	va_end(args);
 }
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 78b2d03bf808..77d82fce371d 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -101,7 +101,8 @@ i915_load_error(struct drm_i915_private *dev_priv, const char *fmt, ...)
 	vaf.fmt = fmt;
 	vaf.va = &args;
 
-	drm_dev_printk(kdev, level, DRM_UT_DRIVER, __func__, "", fmt, &vaf);
+	drm_dev_printk(kdev, level, DRM_UT_DRIVER, DRM_NAME, __func__, "",
+		       fmt, &vaf);
 
 	va_end(args);
 
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index eedfbe51795a..8661045ffaf1 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -173,8 +173,8 @@ struct dma_buf_attachment;
  * \param arg arguments
  */
 #define DRM_DEV_ERROR(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, __func__, " *ERROR*",\
-		       fmt, ##__VA_ARGS__)
+	drm_dev_printk(dev, KERN_ERR, DRM_UT_NONE, DRM_NAME, __func__,	\
+		       " *ERROR*", fmt, ##__VA_ARGS__)
 #define DRM_ERROR(fmt, ...)						\
 	drm_printk(KERN_ERR, DRM_UT_NONE, DRM_NAME, fmt, ##__VA_ARGS__)
 
@@ -197,8 +197,8 @@ struct dma_buf_attachment;
 	DRM_DEV_ERROR_RATELIMITED(NULL, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_INFO(dev, fmt, ...)					\
-	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, __func__, "", fmt,	\
-		       ##__VA_ARGS__)
+	drm_dev_printk(dev, KERN_INFO, DRM_UT_NONE, DRM_NAME, __func__,	\
+		       "", fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_INFO_ONCE(dev, fmt, ...)				\
 ({									\
@@ -216,38 +216,38 @@ struct dma_buf_attachment;
  * \param arg arguments
  */
 #define DRM_DEV_DEBUG(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, __func__, "", fmt,	\
-		       ##args)
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_CORE, DRM_NAME, __func__,\
+		       "", fmt, ##args)
 #define DRM_DEBUG(fmt, ...)						\
 	drm_printk(KERN_DEBUG, DRM_UT_CORE, DRM_NAME, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_DEBUG_DRIVER(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, __func__, "",	\
-		       fmt, ##args)
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_DRIVER, DRM_NAME,	\
+		       __func__, "", fmt, ##args)
 #define DRM_DEBUG_DRIVER(fmt, ...)					\
 	drm_printk(KERN_DEBUG, DRM_UT_DRIVER, DRM_NAME, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_DEBUG_KMS(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, __func__, "", fmt,	\
-		       ##args)
-#define DRM_DEBUG_KMS(fmt, ...)					\
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_KMS, DRM_NAME, __func__,	\
+		       "", fmt, ##args)
+#define DRM_DEBUG_KMS(fmt, ...)						\
 	drm_printk(KERN_DEBUG, DRM_UT_KMS, DRM_NAME, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_DEBUG_PRIME(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, __func__, "",	\
-		       fmt, ##args)
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_PRIME, DRM_NAME,		\
+		       __func__, "", fmt, ##args)
 #define DRM_DEBUG_PRIME(fmt, ...)					\
 	drm_printk(KERN_DEBUG, DRM_UT_PRIME, DRM_NAME, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_DEBUG_ATOMIC(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, __func__, "",	\
-		       fmt, ##args)
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ATOMIC, DRM_NAME,	\
+		       __func__, "", fmt, ##args)
 #define DRM_DEBUG_ATOMIC(fmt, ...)					\
 	drm_printk(KERN_DEBUG, DRM_UT_ATOMIC, DRM_NAME, fmt, ##__VA_ARGS__)
 
 #define DRM_DEV_DEBUG_VBL(dev, fmt, args...)				\
-	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, __func__, "", fmt,	\
-		       ##args)
+	drm_dev_printk(dev, KERN_DEBUG, DRM_UT_VBL, DRM_NAME, __func__,	\
+		       "", fmt, ##args)
 #define DRM_DEBUG_VBL(fmt, ...)					\
 	drm_printk(KERN_DEBUG, DRM_UT_VBL, DRM_NAME, fmt, ##__VA_ARGS__)
 
@@ -258,7 +258,7 @@ struct dma_buf_attachment;
 				      DEFAULT_RATELIMIT_BURST);		\
 	if (__ratelimit(&_rs))						\
 		drm_dev_printk(dev, KERN_DEBUG, DRM_UT_ ## level,	\
-			       __func__, "", fmt, ##args);		\
+			       DRM_NAME, __func__, "", fmt, ##args);	\
 })
 
 /**
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 0ad6cde5757b..8299c13004df 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -407,10 +407,11 @@ struct drm_driver {
 	struct list_head legacy_dev_list;
 };
 
-extern __printf(6, 7)
+extern __printf(7, 8)
 void drm_dev_printk(const struct device *dev, const char *level,
-		    unsigned int category, const char *function_name,
-		    const char *prefix, const char *format, ...);
+		    unsigned int category, const char *driver,
+		    const char *function_name, const char *prefix,
+		    const char *format, ...);
 extern __printf(4, 5)
 void drm_printk(const char *level, unsigned int category,
 		const char *driver, const char *format, ...);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux