[Intel-gfx] [RFC 2/7] drm/i915/i915_utils: add dev_WARN_ON and dev_WARN_ON_ONCE macros

Pankaj Bharadiya pankaj.laxminarayan.bharadiya at intel.com
Mon Jan 6 17:23:21 UTC 2020


It's quite useful to print the device name on the stack dump caused
by WARN_ON*.

Introduce dev_WARN_ON and dev_WARN_ON_ONCE macros for the same.

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya at intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index b0ade76bec90..b4b4d326590c 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -52,6 +52,14 @@ struct timer_list;
 #define MISSING_CASE(x) WARN(1, "Missing case (%s == %ld)\n", \
 			     __stringify(x), (long)(x))
 
+#undef dev_WARN_ON
+#define dev_WARN_ON(dev, x) dev_WARN((dev), (x), "%s", \
+				     "WARN_ON(" __stringify(x) ")")
+
+#undef dev_WARN_ON_ONCE
+#define dev_WARN_ON_ONCE(dev, x) dev_WARN_ONCE((dev), (x), "%s", \
+					  "WARN_ON_ONCE(" __stringify(x) ")")
+
 void __printf(3, 4)
 __i915_printk(struct drm_i915_private *dev_priv, const char *level,
 	      const char *fmt, ...);
-- 
2.23.0



More information about the Intel-gfx mailing list