We're trying to find a rate that we know is in a sorted array. We don't need to limit the array using the max rate. Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- drivers/gpu/drm/i915/intel_dp.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 518b7ff17ad6..ad62effafaed 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -314,25 +314,16 @@ static int intel_dp_common_len_rate_limit(struct intel_dp *intel_dp, return 0; } -static int intel_dp_link_rate_index(struct intel_dp *intel_dp, int link_rate) -{ - int common_len; - - common_len = intel_dp_common_len_rate_limit(intel_dp, - intel_dp->max_sink_link_rate); - - return intel_dp_find_rate(intel_dp->common_rates, common_len, link_rate); -} - int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, int link_rate, uint8_t lane_count) { - const int *common_rates = intel_dp->common_rates; - int link_rate_index; + int index; - link_rate_index = intel_dp_link_rate_index(intel_dp, link_rate); - if (link_rate_index > 0) { - intel_dp->max_sink_link_rate = common_rates[link_rate_index - 1]; + index = intel_dp_find_rate(intel_dp->common_rates, + intel_dp->num_common_rates, + link_rate); + if (index > 0) { + intel_dp->max_sink_link_rate = intel_dp->common_rates[index - 1]; intel_dp->max_sink_lane_count = lane_count; } else if (lane_count > 1) { intel_dp->max_sink_link_rate = intel_dp_max_sink_rate(intel_dp); -- 2.1.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx