diff mbox

[2/4] drm/i915: PSR: Organize PSR enable function

Message ID 1410909548-4945-2-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi Sept. 16, 2014, 11:19 p.m. UTC
We don't need to setup everything else if it doesn't match all conditions.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Paulo Zanoni Sept. 23, 2014, 9:05 p.m. UTC | #1
2014-09-16 20:19 GMT-03:00 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
> We don't need to setup everything else if it doesn't match all conditions.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 271788e..168b3c3 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1912,10 +1912,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);
> @@ -1924,8 +1926,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);
>  }
>
> --
> 1.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Sept. 24, 2014, 8:37 a.m. UTC | #2
On Tue, Sep 23, 2014 at 06:05:21PM -0300, Paulo Zanoni wrote:
> 2014-09-16 20:19 GMT-03:00 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
> > We don't need to setup everything else if it doesn't match all conditions.
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Merged the first two patches to dinq.
-Daniel

> 
> >
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 271788e..168b3c3 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -1912,10 +1912,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);
> > @@ -1924,8 +1926,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);
> >  }
> >
> > --
> > 1.9.3
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Paulo Zanoni
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 271788e..168b3c3 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1912,10 +1912,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);
@@ -1924,8 +1926,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);
 }