[PATCH] drm/dp: Fix hard-coded lane count

Nathan Ciobanu nathan.d.ciobanu at linux.intel.com
Fri Jul 20 02:01:22 UTC 2018


Removes a hard-coded "4" DP lane count as there may be
devices training at less than 4 lanes.

Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu at linux.intel.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
index f81068ba4cc6..57d4d625ba59 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
@@ -236,7 +236,7 @@ static void amdgpu_atombios_dp_get_adjust_train(const u8 link_status[DP_LINK_STA
 		  voltage_names[(v & DP_TRAIN_VOLTAGE_SWING_MASK) >> DP_TRAIN_VOLTAGE_SWING_SHIFT],
 		  pre_emph_names[(p & DP_TRAIN_PRE_EMPHASIS_MASK) >> DP_TRAIN_PRE_EMPHASIS_SHIFT]);
 
-	for (lane = 0; lane < 4; lane++)
+	for (lane = 0; lane < lane_count; lane++)
 		train_set[lane] = v | p;
 }
 
diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c
index 90ed20083009..26b916833241 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c
@@ -1325,7 +1325,7 @@ static void cdv_intel_dp_commit(struct drm_encoder *encoder)
 	if (p == DP_TRAIN_PRE_EMPHASIS_MASK)
 		p |= DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
 		
-	for (lane = 0; lane < 4; lane++)
+	for (lane = 0; lane < intel_dp->lane_count; lane++)
 		intel_dp->train_set[lane] = v | p;
 }
 
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index 4da6e33c7fa1..7e9d73e8a895 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -60,7 +60,7 @@
 	if (p >= preemph_max)
 		p = preemph_max | DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
 
-	for (lane = 0; lane < 4; lane++)
+	for (lane = 0; lane < intel_dp->lane_count; lane++)
 		intel_dp->train_set[lane] = v | p;
 }
 
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 3e798593e042..84aa71837566 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -286,7 +286,7 @@ static void dp_get_adjust_train(const u8 link_status[DP_LINK_STATUS_SIZE],
 		  voltage_names[(v & DP_TRAIN_VOLTAGE_SWING_MASK) >> DP_TRAIN_VOLTAGE_SWING_SHIFT],
 		  pre_emph_names[(p & DP_TRAIN_PRE_EMPHASIS_MASK) >> DP_TRAIN_PRE_EMPHASIS_SHIFT]);
 
-	for (lane = 0; lane < 4; lane++)
+	for (lane = 0; lane < lane_count; lane++)
 		train_set[lane] = v | p;
 }
 
-- 
1.9.1



More information about the Intel-gfx-trybot mailing list