<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 16, 2014 at 10:51 AM, Daniel Vetter <span dir="ltr"><<a href="mailto:daniel.vetter@ffwll.ch" target="_blank">daniel.vetter@ffwll.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Trying to fish that one out through looping is a bit a locking<br>
nightmare. So just set it and use it in the work struct.<br>
<br>
Cc: Rodrigo Vivi <<a href="mailto:rodrigo.vivi@intel.com">rodrigo.vivi@intel.com</a>><br>
Signed-off-by: Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch">daniel.vetter@ffwll.ch</a>><br>
---<br>
 drivers/gpu/drm/i915/i915_drv.h |  3 ++-<br>
 drivers/gpu/drm/i915/intel_dp.c | 21 +++++++--------------<br>
 2 files changed, 9 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h<br>
index f5db29428406..759f7c6d1622 100644<br>
--- a/drivers/gpu/drm/i915/i915_drv.h<br>
+++ b/drivers/gpu/drm/i915/i915_drv.h<br>
@@ -633,10 +633,11 @@ struct i915_drrs {<br>
        struct intel_connector *connector;<br>
 };<br>
<br>
+struct intel_dp;<br>
 struct i915_psr {<br>
        bool sink_support;<br>
        bool source_ok;<br>
-       bool enabled;<br>
+       struct intel_dp *enabled;<br>
        bool active;<br>
        struct delayed_work work;<br>
 };<br>
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c<br>
index ac1cef459a7b..10bcc052df4b 100644<br>
--- a/drivers/gpu/drm/i915/intel_dp.c<br>
+++ b/drivers/gpu/drm/i915/intel_dp.c<br>
@@ -1826,7 +1826,7 @@ static void intel_edp_psr_do_enable(struct intel_dp *intel_dp)<br>
        /* Enable PSR on the host */<br>
        intel_edp_psr_enable_source(intel_dp);<br>
<br>
-       dev_priv->psr.enabled = true;<br>
+       dev_priv->psr.enabled = intel_dp;<br></blockquote><div><br></div><div>I liked this very much...</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        dev_priv->psr.active = true;<br>
 }<br>
<br>
@@ -1867,26 +1867,19 @@ void intel_edp_psr_disable(struct intel_dp *intel_dp)<br>
                       EDP_PSR_STATUS_STATE_MASK) == 0, 2000, 10))<br>
                DRM_ERROR("Timed out waiting for PSR Idle State\n");<br>
<br>
-       dev_priv->psr.enabled = false;<br>
+       dev_priv->psr.enabled = NULL;<br>
 }<br>
<br>
 static void intel_edp_psr_work(struct work_struct *work)<br>
 {<br>
        struct drm_i915_private *dev_priv =<br>
                container_of(work, typeof(*dev_priv), psr.work.work);<br>
-       struct drm_device *dev = dev_priv->dev;<br>
-       struct intel_encoder *encoder;<br>
-       struct intel_dp *intel_dp = NULL;<br>
-<br>
-       list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head)<br>
-               if (encoder->type == INTEL_OUTPUT_EDP) {<br>
-                       intel_dp = enc_to_intel_dp(&encoder->base);<br>
+       struct intel_dp *intel_dp = dev_priv->psr.enabled;<br>
<br></blockquote><div><br></div><div>but I'm afraid to give NULL to below functions...</div><div>Shouldn't we add a if(!intel_dp) return;  at least just to be on the safe side?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

-                       if (!intel_edp_psr_match_conditions(intel_dp))<br>
-                               intel_edp_psr_disable(intel_dp);<br>
-                       else<br>
-                               intel_edp_psr_do_enable(intel_dp);<br>
-               }<br>
+       if (!intel_edp_psr_match_conditions(intel_dp))<br>
+               intel_edp_psr_disable(intel_dp);<br>
+       else<br>
+               intel_edp_psr_do_enable(intel_dp);<br>
 }<br>
<br>
 static void intel_edp_psr_inactivate(struct drm_device *dev)<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.0.0<br>
<br>
_______________________________________________<br>
Intel-gfx mailing list<br>
<a href="mailto:Intel-gfx@lists.freedesktop.org">Intel-gfx@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/intel-gfx" target="_blank">http://lists.freedesktop.org/mailman/listinfo/intel-gfx</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Rodrigo Vivi</div><div>Blog: <a href="http://blog.vivi.eng.br" target="_blank">http://blog.vivi.eng.br</a></div><div> </div>
</div></div>