From: Ville Syrjälä <ville.syrj...@linux.intel.com>

Move some of the more trivial checks in the DP .mode_valid()
hooks upwards to lessen the noise amongst the more complex
checks.

Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c     |  6 +++---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 21 ++++++++++-----------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index bc9d6efc99ee..2490ce32da50 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1229,6 +1229,9 @@ intel_dp_mode_valid(struct drm_connector *_connector,
        if (mode->flags & DRM_MODE_FLAG_DBLCLK)
                return MODE_H_ILLEGAL;
 
+       if (mode->clock < 10000)
+               return MODE_CLOCK_LOW;
+
        fixed_mode = intel_panel_fixed_mode(connector, mode);
        if (intel_dp_is_edp(intel_dp) && fixed_mode) {
                status = intel_panel_mode_valid(connector, mode);
@@ -1238,9 +1241,6 @@ intel_dp_mode_valid(struct drm_connector *_connector,
                target_clock = fixed_mode->clock;
        }
 
-       if (mode->clock < 10000)
-               return MODE_CLOCK_LOW;
-
        if (intel_dp_need_bigjoiner(intel_dp, mode->hdisplay, target_clock)) {
                bigjoiner = true;
                max_dotclk *= 2;
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c 
b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 9a7c75039989..1405ab5e3acc 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -1302,6 +1302,16 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector 
*connector,
        if (*status != MODE_OK)
                return 0;
 
+       if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
+               *status = MODE_H_ILLEGAL;
+               return 0;
+       }
+
+       if (mode->clock < 10000) {
+               *status = MODE_CLOCK_LOW;
+               return 0;
+       }
+
        max_link_clock = intel_dp_max_link_rate(intel_dp);
        max_lanes = intel_dp_max_lane_count(intel_dp);
 
@@ -1330,17 +1340,6 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector 
*connector,
                *status = MODE_CLOCK_HIGH;
                return 0;
        }
-
-       if (mode->clock < 10000) {
-               *status = MODE_CLOCK_LOW;
-               return 0;
-       }
-
-       if (mode->flags & DRM_MODE_FLAG_DBLCLK) {
-               *status = MODE_H_ILLEGAL;
-               return 0;
-       }
-
        if (intel_dp_need_bigjoiner(intel_dp, mode->hdisplay, target_clock)) {
                bigjoiner = true;
                max_dotclk *= 2;
-- 
2.43.2

Reply via email to