drm/i915: Simplify _STATE_ debug macros
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Fri, 18 Dec 2015 12:27:26 +0000 (14:27 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 22 Dec 2015 09:02:57 +0000 (10:02 +0100)
Take advantage of WARN return value to simplify the flow.

Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450441647-23924-2-git-send-email-joonas.lahtinen@linux.intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h

index 89788dead96adef0939b67517fb1e0020c45632d..e0782b0fed73261134f0fbe924e70d3bae62df22 100644 (file)
  */
 #define I915_STATE_WARN(condition, format...) ({                       \
        int __ret_warn_on = !!(condition);                              \
-       if (unlikely(__ret_warn_on)) {                                  \
-               if (i915.verbose_state_checks)                          \
-                       WARN(1, format);                                \
-               else                                                    \
+       if (unlikely(__ret_warn_on))                                    \
+               if (!WARN(i915.verbose_state_checks, format))           \
                        DRM_ERROR(format);                              \
-       }                                                               \
        unlikely(__ret_warn_on);                                        \
 })
 
 #define I915_STATE_WARN_ON(condition) ({                               \
        int __ret_warn_on = !!(condition);                              \
-       if (unlikely(__ret_warn_on)) {                                  \
-               if (i915.verbose_state_checks)                          \
-                       WARN(1, "WARN_ON(" #condition ")\n");           \
-               else                                                    \
+       if (unlikely(__ret_warn_on))                                    \
+               if (!WARN(i915.verbose_state_checks,                    \
+                         "WARN_ON(" #condition ")\n"))                 \
                        DRM_ERROR("WARN_ON(" #condition ")\n");         \
-       }                                                               \
        unlikely(__ret_warn_on);                                        \
 })