drm/i915: PSR: Organize PSR enable function
authorRodrigo Vivi <rodrigo.vivi@gmail.com>
Tue, 16 Sep 2014 23:19:06 +0000 (19:19 -0400)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 24 Sep 2014 08:37:00 +0000 (10:37 +0200)
We don't need to setup everything else if it doesn't match all conditions.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c

index e0066c0..43b381a 100644 (file)
@@ -2148,10 +2148,12 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp)
        mutex_lock(&dev_priv->psr.lock);
        if (dev_priv->psr.enabled) {
                DRM_DEBUG_KMS("PSR already in use\n");
-               mutex_unlock(&dev_priv->psr.lock);
-               return;
+               goto unlock;
        }
 
+       if (!intel_edp_psr_match_conditions(intel_dp))
+               goto unlock;
+
        dev_priv->psr.busy_frontbuffer_bits = 0;
 
        intel_edp_psr_setup_vsc(intel_dp);
@@ -2160,8 +2162,8 @@ void intel_edp_psr_enable(struct intel_dp *intel_dp)
        I915_WRITE(EDP_PSR_DEBUG_CTL(dev), EDP_PSR_DEBUG_MASK_MEMUP |
                   EDP_PSR_DEBUG_MASK_HPD | EDP_PSR_DEBUG_MASK_LPSP);
 
-       if (intel_edp_psr_match_conditions(intel_dp))
-               dev_priv->psr.enabled = intel_dp;
+       dev_priv->psr.enabled = intel_dp;
+unlock:
        mutex_unlock(&dev_priv->psr.lock);
 }