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

Message ID 20200106172326.32592-3-pankaj.laxminarayan.bharadiya@intel.com
State New
Headers show
  • drm/i915: Convert WARN* to use device-specific variants
Related show

Commit Message

Pankaj Bharadiya Jan. 6, 2020, 5:23 p.m. UTC
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@intel.com>
 drivers/gpu/drm/i915/i915_utils.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff mbox series

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, ...);