Skip to contentSkip to conversation

drm/bridge: analogix-anx6345: Fix drm_dp_link helper removal

PATCH RESEND Superseded Torsten Duwe 1 participant 1 message Feb 18, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 drm/bridge: analogix-anx6345: Fix drm_dp_link helper removal

drm_dp_link_rate_to_bw_code and ...bw_code_to_link_rate simply divide by and multiply with 27000, respectively. Avoid an overflow in the u8 dpcd[0] and the multiply+divide alltogether.

Fixes e1cff82c1097bda2478 ("fix anx6345 compilation for v5.5")

---
https://patchwork.freedesktop.org/patch/343004/
https://lists.freedesktop.org/archives/dri-devel/2020-January/253535.html

drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +2 -3
@@ -210,10 +210,9 @@ static int anx6345_dp_link_training(struct anx6345 *anx6345)
 	if (err)
 		return err;
 
-	dpcd[0] = drm_dp_max_link_rate(anx6345->dpcd);
-	dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]);
 	err = regmap_write(anx6345->map[I2C_IDX_DPTX],
-			   SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]);
+			   SP_DP_MAIN_LINK_BW_SET_REG,
+			   anx6345->dpcd[DP_MAX_LINK_RATE]);
 	if (err)
 		return err;