[Intel-gfx] [PATCH 1/2] drm/i915: Optimize the live status retry logic

Shashank Sharma shashank.sharma at intel.com
Fri Mar 11 18:20:59 UTC 2016


There is an extra 'if (try)' check, which can be avoided by
changing the logic slightly, keeping the delay as same(80ms)

Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
---
 drivers/gpu/drm/i915/intel_hdmi.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e2dab48..b523a2f 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1397,24 +1397,21 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	enum drm_connector_status status;
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
+	bool live_status = true;
+	unsigned int try = 8;
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
-
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
+	live_status = intel_digital_port_connected(dev_priv,
+		hdmi_to_dig_port(intel_hdmi));
+	while (!live_status && try--) {
+		msleep(10);
 		live_status = intel_digital_port_connected(dev_priv,
-				hdmi_to_dig_port(intel_hdmi));
+			hdmi_to_dig_port(intel_hdmi));
 	}
 
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
 	intel_hdmi_unset_edid(connector);
 
 	if (intel_hdmi_set_edid(connector, live_status)) {
-- 
1.9.1



More information about the Intel-gfx mailing list