diff mbox

[v3,8/14] drm/i915/dp: Move max. vswing check to it's own function

Message ID 1473272883-28520-1-git-send-email-manasi.d.navare@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Navare, Manasi Sept. 7, 2016, 6:28 p.m. UTC
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

v3:
Fixed the paranthesis warning (Mika Kahola)
v2:
Fixed the Compiler warning (Mika Kahola)

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/i915/intel_dp_link_training.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Kahola, Mika Sept. 8, 2016, 7:38 a.m. UTC | #1
This compiler warning is fixed with the next patch of the series.

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:131:6: warning: unused
variable ‘i’ [-Wunused-variable]

Therefore,

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

On Wed, 2016-09-07 at 11:28 -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
> 
> v3:
> Fixed the paranthesis warning (Mika Kahola)
> v2:
> Fixed the Compiler warning (Mika Kahola)
> 
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp_link_training.c | 17 +++++++++++++----
>  1 file changed, 13 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..b9880cf 100644
> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
> @@ -112,6 +112,18 @@ 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 +182,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");
Jani Nikula Sept. 13, 2016, 11:44 a.m. UTC | #2
On Thu, 08 Sep 2016, Mika Kahola <mika.kahola@intel.com> wrote:
> This compiler warning is fixed with the next patch of the series.
>
> 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:131:6: warning: unused
> variable ‘i’ [-Wunused-variable]
>
> Therefore,

This may seem like a minor thing, but this is not the way we generally
work. Each patch must be self contained, and not depend on the follow-up
work, which may get stalled or reverted or whatnot.

And I don't like to receive stuff like this [1], especially for things
that were known in advance.


BR,
Jani.


[1] https://lists.freedesktop.org/archives/intel-gfx/2016-September/106306.html


>
> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
>
> On Wed, 2016-09-07 at 11:28 -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
>> 
>> v3:
>> Fixed the paranthesis warning (Mika Kahola)
>> v2:
>> Fixed the Compiler warning (Mika Kahola)
>> 
>> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
>> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dp_link_training.c | 17 +++++++++++++----
>>  1 file changed, 13 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..b9880cf 100644
>> --- a/drivers/gpu/drm/i915/intel_dp_link_training.c
>> +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
>> @@ -112,6 +112,18 @@ 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 +182,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");
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 0deebed..b9880cf 100644
--- a/drivers/gpu/drm/i915/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/intel_dp_link_training.c
@@ -112,6 +112,18 @@  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 +182,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");