[v3,12/14] drm/i915/dp: localize link rate index variable more

Submitted by Jani Nikula on March 28, 2017, 2:59 p.m.

Details

Message ID 885a3d5a3ed7cb3215fda6ca0a924ea9e0a4bcdf.1490712890.git.jani.nikula@intel.com
State New
Headers show
Series "drm/i915/dp: link rate and lane count refactoring" ( rev: 4 3 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula March 28, 2017, 2:59 p.m.
Localize link_rate_index to the if block, and rename to just index to
reduce indent.

Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 95f2278700e3..6f743490855b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1636,7 +1636,6 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 	/* Conveniently, the link BW constants become indices with a shift...*/
 	int min_clock = 0;
 	int max_clock;
-	int link_rate_index;
 	int bpp, mode_rate;
 	int link_avail, link_clock;
 	int common_len;
@@ -1680,11 +1679,13 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 
 	/* Use values requested by Compliance Test Request */
 	if (intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) {
-		link_rate_index = intel_dp_rate_index(intel_dp->common_rates,
-						      intel_dp->num_common_rates,
-						      intel_dp->compliance.test_link_rate);
-		if (link_rate_index >= 0)
-			min_clock = max_clock = link_rate_index;
+		int index;
+
+		index = intel_dp_rate_index(intel_dp->common_rates,
+					    intel_dp->num_common_rates,
+					    intel_dp->compliance.test_link_rate);
+		if (index >= 0)
+			min_clock = max_clock = index;
 		min_lane_count = max_lane_count = intel_dp->compliance.test_lane_count;
 	}
 	DRM_DEBUG_KMS("DP link computation with max lane count %i "

Comments

Why not squash this with patch 08/14? and call it cleanup for obtaining the
rate index using intel_dp_rate_index()
Just a thought..

Regards
Manasi

On Tue, Mar 28, 2017 at 05:59:12PM +0300, Jani Nikula wrote:
> Localize link_rate_index to the if block, and rename to just index to
> reduce indent.
> 
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 95f2278700e3..6f743490855b 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1636,7 +1636,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	/* Conveniently, the link BW constants become indices with a shift...*/
>  	int min_clock = 0;
>  	int max_clock;
> -	int link_rate_index;
>  	int bpp, mode_rate;
>  	int link_avail, link_clock;
>  	int common_len;
> @@ -1680,11 +1679,13 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  
>  	/* Use values requested by Compliance Test Request */
>  	if (intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) {
> -		link_rate_index = intel_dp_rate_index(intel_dp->common_rates,
> -						      intel_dp->num_common_rates,
> -						      intel_dp->compliance.test_link_rate);
> -		if (link_rate_index >= 0)
> -			min_clock = max_clock = link_rate_index;
> +		int index;
> +
> +		index = intel_dp_rate_index(intel_dp->common_rates,
> +					    intel_dp->num_common_rates,
> +					    intel_dp->compliance.test_link_rate);
> +		if (index >= 0)
> +			min_clock = max_clock = index;
>  		min_lane_count = max_lane_count = intel_dp->compliance.test_lane_count;
>  	}
>  	DRM_DEBUG_KMS("DP link computation with max lane count %i "
> -- 
> 2.1.4
>
On Wed, 29 Mar 2017, Manasi Navare <manasi.d.navare@intel.com> wrote:
> Why not squash this with patch 08/14? and call it cleanup for obtaining the
> rate index using intel_dp_rate_index()
> Just a thought..

Again, usually too big patches are the problem, not the other way
around.

BR,
Jani.

>
> Regards
> Manasi
>
> On Tue, Mar 28, 2017 at 05:59:12PM +0300, Jani Nikula wrote:
>> Localize link_rate_index to the if block, and rename to just index to
>> reduce indent.
>> 
>> Cc: Manasi Navare <manasi.d.navare@intel.com>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_dp.c | 13 +++++++------
>>  1 file changed, 7 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index 95f2278700e3..6f743490855b 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -1636,7 +1636,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>>  	/* Conveniently, the link BW constants become indices with a shift...*/
>>  	int min_clock = 0;
>>  	int max_clock;
>> -	int link_rate_index;
>>  	int bpp, mode_rate;
>>  	int link_avail, link_clock;
>>  	int common_len;
>> @@ -1680,11 +1679,13 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>>  
>>  	/* Use values requested by Compliance Test Request */
>>  	if (intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) {
>> -		link_rate_index = intel_dp_rate_index(intel_dp->common_rates,
>> -						      intel_dp->num_common_rates,
>> -						      intel_dp->compliance.test_link_rate);
>> -		if (link_rate_index >= 0)
>> -			min_clock = max_clock = link_rate_index;
>> +		int index;
>> +
>> +		index = intel_dp_rate_index(intel_dp->common_rates,
>> +					    intel_dp->num_common_rates,
>> +					    intel_dp->compliance.test_link_rate);
>> +		if (index >= 0)
>> +			min_clock = max_clock = index;
>>  		min_lane_count = max_lane_count = intel_dp->compliance.test_lane_count;
>>  	}
>>  	DRM_DEBUG_KMS("DP link computation with max lane count %i "
>> -- 
>> 2.1.4
>>
On Wed, Mar 29, 2017 at 10:22:32AM +0300, Jani Nikula wrote:
> On Wed, 29 Mar 2017, Manasi Navare <manasi.d.navare@intel.com> wrote:
> > Why not squash this with patch 08/14? and call it cleanup for obtaining the
> > rate index using intel_dp_rate_index()
> > Just a thought..
> 
> Again, usually too big patches are the problem, not the other way
> around.
> 
> BR,
> Jani.
>

OK, your call. Functionality wise looks good and I have tested this.


> >
> > Regards
> > Manasi
> >
> > On Tue, Mar 28, 2017 at 05:59:12PM +0300, Jani Nikula wrote:
> >> Localize link_rate_index to the if block, and rename to just index to
> >> reduce indent.
> >> 
> >> Cc: Manasi Navare <manasi.d.navare@intel.com>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Reviewed-by: <manasi.d.navare@intel.com>
> >> ---
> >>  drivers/gpu/drm/i915/intel_dp.c | 13 +++++++------
> >>  1 file changed, 7 insertions(+), 6 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> >> index 95f2278700e3..6f743490855b 100644
> >> --- a/drivers/gpu/drm/i915/intel_dp.c
> >> +++ b/drivers/gpu/drm/i915/intel_dp.c
> >> @@ -1636,7 +1636,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >>  	/* Conveniently, the link BW constants become indices with a shift...*/
> >>  	int min_clock = 0;
> >>  	int max_clock;
> >> -	int link_rate_index;
> >>  	int bpp, mode_rate;
> >>  	int link_avail, link_clock;
> >>  	int common_len;
> >> @@ -1680,11 +1679,13 @@ intel_dp_compute_config(struct intel_encoder *encoder,
> >>  
> >>  	/* Use values requested by Compliance Test Request */
> >>  	if (intel_dp->compliance.test_type == DP_TEST_LINK_TRAINING) {
> >> -		link_rate_index = intel_dp_rate_index(intel_dp->common_rates,
> >> -						      intel_dp->num_common_rates,
> >> -						      intel_dp->compliance.test_link_rate);
> >> -		if (link_rate_index >= 0)
> >> -			min_clock = max_clock = link_rate_index;
> >> +		int index;
> >> +
> >> +		index = intel_dp_rate_index(intel_dp->common_rates,
> >> +					    intel_dp->num_common_rates,
> >> +					    intel_dp->compliance.test_link_rate);
> >> +		if (index >= 0)
> >> +			min_clock = max_clock = index;
> >>  		min_lane_count = max_lane_count = intel_dp->compliance.test_lane_count;
> >>  	}
> >>  	DRM_DEBUG_KMS("DP link computation with max lane count %i "
> >> -- 
> >> 2.1.4
> >> 
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center