[Intel-gfx] [PATCH v4 2/2] drm/i915/dp: Remove unneeded mav_vswing_tries variable

Nathan Ciobanu nathan.d.ciobanu at linux.intel.com
Thu Jul 19 18:40:59 UTC 2018


max_vswing_tries variable was declared as an int but
used as a bool and not even needed because we can
just check the return of intel_dp_link_max_vswing_reached.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Marc Herbert <marc.herbert at intel.com>
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index 05f209f6d73f..ddfdd5d05168 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
 {
 	uint8_t voltage;
-	int voltage_tries, max_vswing_tries, cr_tries, max_cr_tries;
+	int voltage_tries, cr_tries, max_cr_tries;
 	uint8_t link_config[2];
 	uint8_t link_bw, rate_select;
 
@@ -181,7 +181,6 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 		max_cr_tries = 80;
 
 	voltage_tries = 1;
-	max_vswing_tries = 0;
 	for (cr_tries = 0; cr_tries < max_cr_tries; ++cr_tries) {
 		uint8_t link_status[DP_LINK_STATUS_SIZE];
 
@@ -202,11 +201,6 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 			return false;
 		}
 
-		if (max_vswing_tries == 1) {
-			DRM_DEBUG_KMS("Max Voltage Swing reached\n");
-			return false;
-		}
-
 		voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
 
 		/* Update training set as requested by target */
@@ -222,8 +216,10 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 		else
 			voltage_tries = 1;
 
-		if (intel_dp_link_max_vswing_reached(intel_dp))
-			++max_vswing_tries;
+		if (intel_dp_link_max_vswing_reached(intel_dp)) {
+			DRM_DEBUG_KMS("Max Voltage Swing reached\n");
+			return false;
+		}
 
 	}
 	DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);
-- 
1.9.1



More information about the Intel-gfx mailing list