Skip to contentSkip to conversation

drm/print: add DRM_DEV_WARN macro

PATCH In review Wambui Karuga 3 participants 3 messages Nov 12, 2019 – Nov 13, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/print: add DRM_DEV_WARN macro

Add the DRM_DEV_WARN helper macro for printing warnings that use device pointers in their log output format. DRM_DEV_WARN can replace the use of dev_warn in such cases.

---
 include/drm/drm_print.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/drm/drm_print.h +9 -0
index 5b8049992c24..6ddf91c0cb29 100644
@@ -329,6 +329,15 @@ void drm_err(const char *format, ...);
 #define DRM_WARN_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
 
+/**
+ * Warning output.
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
+#define DRM_DEV_WARN(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
+
 /**
  * Error output.
  *
Signature · 1 line
2.17.1
#1 lore raw
Quoted 5 lines · Wambui Karuga

Add the DRM_DEV_WARN helper macro for printing warnings that use device pointers in their log output format. DRM_DEV_WARN can replace the use of dev_warn in such cases.

Can you pls include this in the patch to add the first user with rockchip? Otherwise always a bit awkward when we add functions without callers.

lgtm otherwise.
-Daniel

Quoted 27 lines
---
 include/drm/drm_print.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/drm/drm_print.h +9 -0
index 5b8049992c24..6ddf91c0cb29 100644
@@ -329,6 +329,15 @@ void drm_err(const char *format, ...);
 #define DRM_WARN_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
 
+/**
+ * Warning output.
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
+#define DRM_DEV_WARN(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
+
 /**
  * Error output.
  *
Signature · 1 line
2.17.1
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
Quoted 10 lines · Daniel Vetter
Quoted 5 lines · Wambui Karuga

Add the DRM_DEV_WARN helper macro for printing warnings that use device pointers in their log output format. DRM_DEV_WARN can replace the use of dev_warn in such cases.

Can you pls include this in the patch to add the first user with rockchip? Otherwise always a bit awkward when we add functions without callers.

Okay, I'll send that as well.
Thought it'd be better to get this accepted first.

wambui

Quoted 36 lines

lgtm otherwise.
-Daniel

Quoted 27 lines
---
 include/drm/drm_print.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/drm/drm_print.h +9 -1
index 5b8049992c24..6ddf91c0cb29 100644
@@ -329,6 +329,15 @@ void drm_err(const char *format, ...);
 #define DRM_WARN_ONCE(fmt, ...)						\
 	_DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__)
 
+/**
+ * Warning output.
+ *
+ * @dev: device pointer
+ * @fmt: printf() like format string.
+ */
+#define DRM_DEV_WARN(dev, fmt, ...)					\
+	drm_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
+
 /**
  * Error output.
  *
--

2.17.1

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch