diff mbox

[v5,2/2] drm/i915/dp: Refactor mav_vswing_tries variable

Message ID 1532036887-11800-1-git-send-email-nathan.d.ciobanu@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nathan Ciobanu July 19, 2018, 9:48 p.m. UTC
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

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>
---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ville Syrjälä July 20, 2018, 10:19 a.m. UTC | #1
On Thu, Jul 19, 2018 at 02:48:07PM -0700, Nathan Ciobanu wrote:
> 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
> 
> 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>
> ---
>  drivers/gpu/drm/i915/intel_dp_link_training.c | 8 ++++----
>  1 file changed, 4 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 7903de7a54c9..ec5f2bb55c9a 100644
> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> @@ -129,7 +129,8 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
>  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 = false;

max_vswing_reached?

>  	uint8_t link_config[2];
>  	uint8_t link_bw, rate_select;
>  
> @@ -181,7 +182,6 @@ static bool intel_dp_link_max_vswing_reached(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];
>  
> @@ -202,7 +202,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
>  			return false;
>  		}
>  
> -		if (max_vswing_tries == 1) {
> +		if (max_vswing) {
>  			DRM_DEBUG_KMS("Max Voltage Swing reached\n");
>  			return false;
>  		}
> @@ -223,7 +223,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
>  			voltage_tries = 1;
>  
>  		if (intel_dp_link_max_vswing_reached(intel_dp))
> -			++max_vswing_tries;
> +			max_vswing = true;
>  
>  	}
>  	DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Nathan Ciobanu July 20, 2018, 6:27 p.m. UTC | #2
On Fri, Jul 20, 2018 at 01:19:02PM +0300, Ville Syrjälä wrote:
> On Thu, Jul 19, 2018 at 02:48:07PM -0700, Nathan Ciobanu wrote:
> > 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
> > 
> > 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>
> > ---
> >  drivers/gpu/drm/i915/intel_dp_link_training.c | 8 ++++----
> >  1 file changed, 4 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 7903de7a54c9..ec5f2bb55c9a 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> > @@ -129,7 +129,8 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
> >  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 = false;
> 
> max_vswing_reached?
Ok, I renamed it and resent the patch. Thanks,
Nathan
> 
> >  	uint8_t link_config[2];
> >  	uint8_t link_bw, rate_select;
> >  
> > @@ -181,7 +182,6 @@ static bool intel_dp_link_max_vswing_reached(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];
> >  
> > @@ -202,7 +202,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
> >  			return false;
> >  		}
> >  
> > -		if (max_vswing_tries == 1) {
> > +		if (max_vswing) {
> >  			DRM_DEBUG_KMS("Max Voltage Swing reached\n");
> >  			return false;
> >  		}
> > @@ -223,7 +223,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
> >  			voltage_tries = 1;
> >  
> >  		if (intel_dp_link_max_vswing_reached(intel_dp))
> > -			++max_vswing_tries;
> > +			max_vswing = true;
> >  
> >  	}
> >  	DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c
index 7903de7a54c9..ec5f2bb55c9a 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -129,7 +129,8 @@  static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 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 = false;
 	uint8_t link_config[2];
 	uint8_t link_bw, rate_select;
 
@@ -181,7 +182,6 @@  static bool intel_dp_link_max_vswing_reached(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];
 
@@ -202,7 +202,7 @@  static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 			return false;
 		}
 
-		if (max_vswing_tries == 1) {
+		if (max_vswing) {
 			DRM_DEBUG_KMS("Max Voltage Swing reached\n");
 			return false;
 		}
@@ -223,7 +223,7 @@  static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp)
 			voltage_tries = 1;
 
 		if (intel_dp_link_max_vswing_reached(intel_dp))
-			++max_vswing_tries;
+			max_vswing = true;
 
 	}
 	DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);