Message ID | 1472767699-31211-9-git-send-email-manasi.d.navare@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
+1 for this cleanup Reviewed-by: Mika Kahola <mika.kahola@intel.com> On Thu, 2016-09-01 at 15:08 -0700, Manasi Navare wrote: > From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > Wrap the max. vswing check in a separate function. > This makes the clock recovery phase of DP link training cleaner > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > --- > drivers/gpu/drm/i915/intel_dp_link_training.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c > b/drivers/gpu/drm/i915/intel_dp_link_training.c > index 0deebed..9145e5a 100644 > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c > @@ -112,6 +112,17 @@ intel_dp_update_link_train(struct intel_dp > *intel_dp) > return ret == intel_dp->lane_count; > } > > +static bool intel_dp_link_max_vswing_reached(struct intel_dp > *intel_dp) > +{ > + int lane; > + > + for (lane = 0; lane < intel_dp->lane_count; lane++) > + if (intel_dp->train_set[lane] & > DP_TRAIN_MAX_SWING_REACHED == 0) > + return false; > + > + return true; > +} > + > /* Enable corresponding port and start training pattern 1 */ > static void > intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) > @@ -170,10 +181,7 @@ intel_dp_link_training_clock_recovery(struct > intel_dp *intel_dp) > } > > /* Check to see if we've tried the max voltage */ > - for (i = 0; i < intel_dp->lane_count; i++) > - if ((intel_dp->train_set[i] & > DP_TRAIN_MAX_SWING_REACHED) == 0) > - break; > - if (i == intel_dp->lane_count) { > + if (intel_dp_link_max_vswing_reached(intel_dp)) { > ++loop_tries; > if (loop_tries == 5) { > DRM_ERROR("too many full retries, > give up\n");
On Fri, 2016-09-02 at 11:05 +0300, Mika Kahola wrote: > +1 for this cleanup > > Reviewed-by: Mika Kahola <mika.kahola@intel.com> Received couple of compiler warnings to be cleaned up drivers/gpu/drm/i915/intel_dp_link_training.c: In function ‘intel_dp_link_max_vswing_reached’: drivers/gpu/drm/i915/intel_dp_link_training.c:120:33: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses] if (intel_dp->train_set[lane] & DP_TRAIN_MAX_SWING_REACHED == 0) ^ drivers/gpu/drm/i915/intel_dp_link_training.c: In function ‘intel_dp_link_training_clock_recovery’: drivers/gpu/drm/i915/intel_dp_link_training.c:130:6: warning: unused variable ‘i’ [-Wunused-variable] > > On Thu, 2016-09-01 at 15:08 -0700, Manasi Navare wrote: > > > > From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > > > Wrap the max. vswing check in a separate function. > > This makes the clock recovery phase of DP link training cleaner > > > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > --- > > drivers/gpu/drm/i915/intel_dp_link_training.c | 16 ++++++++++++--- > > - > > 1 file changed, 12 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c > > b/drivers/gpu/drm/i915/intel_dp_link_training.c > > index 0deebed..9145e5a 100644 > > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c > > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c > > @@ -112,6 +112,17 @@ intel_dp_update_link_train(struct intel_dp > > *intel_dp) > > return ret == intel_dp->lane_count; > > } > > > > +static bool intel_dp_link_max_vswing_reached(struct intel_dp > > *intel_dp) > > +{ > > + int lane; > > + > > + for (lane = 0; lane < intel_dp->lane_count; lane++) > > + if (intel_dp->train_set[lane] & > > DP_TRAIN_MAX_SWING_REACHED == 0) > > + return false; > > + > > + return true; > > +} > > + > > /* Enable corresponding port and start training pattern 1 */ > > static void > > intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) > > @@ -170,10 +181,7 @@ intel_dp_link_training_clock_recovery(struct > > intel_dp *intel_dp) > > } > > > > /* Check to see if we've tried the max voltage */ > > - for (i = 0; i < intel_dp->lane_count; i++) > > - if ((intel_dp->train_set[i] & > > DP_TRAIN_MAX_SWING_REACHED) == 0) > > - break; > > - if (i == intel_dp->lane_count) { > > + if (intel_dp_link_max_vswing_reached(intel_dp)) { > > ++loop_tries; > > if (loop_tries == 5) { > > DRM_ERROR("too many full retries, > > give up\n"); > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Tue, Sep 06, 2016 at 12:58:29PM +0300, Mika Kahola wrote: > On Fri, 2016-09-02 at 11:05 +0300, Mika Kahola wrote: > > +1 for this cleanup > > > > Reviewed-by: Mika Kahola <mika.kahola@intel.com> > Received couple of compiler warnings to be cleaned up > > drivers/gpu/drm/i915/intel_dp_link_training.c: In function > ‘intel_dp_link_max_vswing_reached’: > drivers/gpu/drm/i915/intel_dp_link_training.c:120:33: warning: suggest > parentheses around comparison in operand of ‘&’ [-Wparentheses] > if (intel_dp->train_set[lane] & DP_TRAIN_MAX_SWING_REACHED == 0) Yep, will fix this warning and resubmit Manasi > ^ > drivers/gpu/drm/i915/intel_dp_link_training.c: In function > ‘intel_dp_link_training_clock_recovery’: > drivers/gpu/drm/i915/intel_dp_link_training.c:130:6: warning: unused > variable ‘i’ [-Wunused-variable] > This unused variable 'i' gets removed in the following patch for making clock recovery DP compliant. Manasi > > > > On Thu, 2016-09-01 at 15:08 -0700, Manasi Navare wrote: > > > > > > From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > > > > > Wrap the max. vswing check in a separate function. > > > This makes the clock recovery phase of DP link training cleaner > > > > > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > > > --- > > > drivers/gpu/drm/i915/intel_dp_link_training.c | 16 ++++++++++++--- > > > - > > > 1 file changed, 12 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c > > > b/drivers/gpu/drm/i915/intel_dp_link_training.c > > > index 0deebed..9145e5a 100644 > > > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c > > > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c > > > @@ -112,6 +112,17 @@ intel_dp_update_link_train(struct intel_dp > > > *intel_dp) > > > return ret == intel_dp->lane_count; > > > } > > > > > > +static bool intel_dp_link_max_vswing_reached(struct intel_dp > > > *intel_dp) > > > +{ > > > + int lane; > > > + > > > + for (lane = 0; lane < intel_dp->lane_count; lane++) > > > + if (intel_dp->train_set[lane] & > > > DP_TRAIN_MAX_SWING_REACHED == 0) > > > + return false; > > > + > > > + return true; > > > +} > > > + > > > /* Enable corresponding port and start training pattern 1 */ > > > static void > > > intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) > > > @@ -170,10 +181,7 @@ intel_dp_link_training_clock_recovery(struct > > > intel_dp *intel_dp) > > > } > > > > > > /* Check to see if we've tried the max voltage */ > > > - for (i = 0; i < intel_dp->lane_count; i++) > > > - if ((intel_dp->train_set[i] & > > > DP_TRAIN_MAX_SWING_REACHED) == 0) > > > - break; > > > - if (i == intel_dp->lane_count) { > > > + if (intel_dp_link_max_vswing_reached(intel_dp)) { > > > ++loop_tries; > > > if (loop_tries == 5) { > > > DRM_ERROR("too many full retries, > > > give up\n"); > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 0deebed..9145e5a 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c @@ -112,6 +112,17 @@ intel_dp_update_link_train(struct intel_dp *intel_dp) return ret == intel_dp->lane_count; } +static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) +{ + int lane; + + for (lane = 0; lane < intel_dp->lane_count; lane++) + if (intel_dp->train_set[lane] & DP_TRAIN_MAX_SWING_REACHED == 0) + return false; + + return true; +} + /* Enable corresponding port and start training pattern 1 */ static void intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) @@ -170,10 +181,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) } /* Check to see if we've tried the max voltage */ - for (i = 0; i < intel_dp->lane_count; i++) - if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0) - break; - if (i == intel_dp->lane_count) { + if (intel_dp_link_max_vswing_reached(intel_dp)) { ++loop_tries; if (loop_tries == 5) { DRM_ERROR("too many full retries, give up\n");