drm/i915/display/overlay: Make WARN* drm specific where drm_priv ptr is available
authorPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Tue, 28 Jan 2020 18:15:56 +0000 (23:45 +0530)
committerJani Nikula <jani.nikula@intel.com>
Tue, 4 Feb 2020 08:53:06 +0000 (10:53 +0200)
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.

Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_i915_private struct pointer is readily
available.

The conversion was done automatically with below coccinelle semantic
patch.

@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

@rule2@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-15-pankaj.laxminarayan.bharadiya@intel.com
drivers/gpu/drm/i915/display/intel_overlay.c

index 365ec6cab3c5704c437d9c402064f1d758fcce5e..5f1207dec10edf2878cc7f2b7e70e9c156235ad0 100644 (file)
@@ -248,7 +248,7 @@ static int intel_overlay_on(struct intel_overlay *overlay)
        struct i915_request *rq;
        u32 *cs;
 
-       WARN_ON(overlay->active);
+       drm_WARN_ON(&dev_priv->drm, overlay->active);
 
        rq = alloc_request(overlay, NULL);
        if (IS_ERR(rq))
@@ -316,7 +316,7 @@ static int intel_overlay_continue(struct intel_overlay *overlay,
        u32 flip_addr = overlay->flip_addr;
        u32 tmp, *cs;
 
-       WARN_ON(!overlay->active);
+       drm_WARN_ON(&dev_priv->drm, !overlay->active);
 
        if (load_polyphase_filter)
                flip_addr |= OFC_UPDATE;
@@ -760,7 +760,8 @@ static int intel_overlay_do_put_image(struct intel_overlay *overlay,
        struct i915_vma *vma;
        int ret, tmp_width;
 
-       WARN_ON(!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
+       drm_WARN_ON(&dev_priv->drm,
+                   !drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
 
        ret = intel_overlay_release_old_vid(overlay);
        if (ret != 0)
@@ -858,7 +859,8 @@ int intel_overlay_switch_off(struct intel_overlay *overlay)
        struct drm_i915_private *dev_priv = overlay->i915;
        int ret;
 
-       WARN_ON(!drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
+       drm_WARN_ON(&dev_priv->drm,
+                   !drm_modeset_is_locked(&dev_priv->drm.mode_config.connection_mutex));
 
        ret = intel_overlay_recover_from_interrupt(overlay);
        if (ret != 0)
@@ -1390,7 +1392,7 @@ void intel_overlay_cleanup(struct drm_i915_private *dev_priv)
         * Furthermore modesetting teardown happens beforehand so the
         * hardware should be off already.
         */
-       WARN_ON(overlay->active);
+       drm_WARN_ON(&dev_priv->drm, overlay->active);
 
        i915_gem_object_put(overlay->reg_bo);
        i915_active_fini(&overlay->last_flip);