]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/dp: Refactor max_vswing_tries variable
authorNathan Ciobanu <nathan.d.ciobanu@linux.intel.com>
Fri, 20 Jul 2018 21:44:13 +0000 (14:44 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Mon, 23 Jul 2018 23:00:07 +0000 (16:00 -0700)
Changes the type and renames the max_vswing_tries variable
which was declared as an integer but used as a boolean
making it easy to be confused with a counter.

Changes in v2:
    - updated the title and commit message
    - left the loop exit point in place

v3: fix typo in title
v4: renamed max_vswing to max_vswing_reached (Ville)

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Marc Herbert <marc.herbert@intel.com>
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180720214413.29506-2-rodrigo.vivi@intel.com
drivers/gpu/drm/i915/intel_dp_link_training.c

index 299cad5632edaebca590aab77a5358d73850f8b9..07e128c7443c7c76c31680e32e3d9047b041f5fc 100644 (file)
@@ -129,7 +129,8 @@ static bool
 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;
+       bool max_vswing_reached = false;
        uint8_t link_config[2];
        uint8_t link_bw, rate_select;
 
@@ -182,7 +183,6 @@ intel_dp_link_training_clock_recovery(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];
 
@@ -203,7 +203,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
                        return false;
                }
 
-               if (max_vswing_tries == 1) {
+               if (max_vswing_reached) {
                        DRM_DEBUG_KMS("Max Voltage Swing reached\n");
                        return false;
                }
@@ -224,7 +224,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
                        voltage_tries = 1;
 
                if (intel_dp_link_max_vswing_reached(intel_dp))
-                       ++max_vswing_tries;
+                       max_vswing_reached = true;
 
        }
        DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);