Skip to contentSkip to conversation

drm/print: add DRM_DEV_WARN macro

PATCH New Wambui Karuga 1 participant 2 messages Nov 14, 2019

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

PATCH 1/2 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

PATCH 2/2 drm/rockchip: use DRM_DEV_WARN macro in debug output

Replace the use of dev_warn in debug output with the new DRM specific DRM_DEV_WARN debug output macro to maintain consistency across the driver.

---
 drivers/gpu/drm/rockchip/inno_hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/inno_hdmi.c +2 -1
index e5864e823020..d7ee8d1835c4 100644
@@ -796,7 +796,8 @@ static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
 
 	ret = i2c_add_adapter(adap);
 	if (ret) {
-		dev_warn(hdmi->dev, "cannot add %s I2C adapter\n", adap->name);
+		DRM_DEV_WARN(hdmi->dev,
+			     "cannot add %s I2C adapter\n", adap->name);
 		devm_kfree(hdmi->dev, i2c);
 		return ERR_PTR(ret);
 	}
Signature · 1 line
2.17.1