[v4,09/11] drm/i915/dp: read sink count to a temporary variable first

Submitted by Jani Nikula on April 6, 2017, 1:44 p.m.

Details

Message ID 37d3222115172922fcd5ab038238359935bd561f.1491485983.git.jani.nikula@intel.com
State New
Headers show
Series "drm/i915/dp: rest of refactoring, link rate fallback" ( rev: 3 2 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula April 6, 2017, 1:44 p.m.
Don't clobber intel_dp->sink_count with the raw value.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 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 81682fd2804b..3c5c80da9ea3 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3728,6 +3728,8 @@  intel_edp_init_dpcd(struct intel_dp *intel_dp)
 static bool
 intel_dp_get_dpcd(struct intel_dp *intel_dp)
 {
+	u8 sink_count;
+
 	if (!intel_dp_read_dpcd(intel_dp))
 		return false;
 
@@ -3737,8 +3739,7 @@  intel_dp_get_dpcd(struct intel_dp *intel_dp)
 		intel_dp_set_common_rates(intel_dp);
 	}
 
-	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_SINK_COUNT,
-			      &intel_dp->sink_count) <= 0)
+	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_SINK_COUNT, &sink_count) <= 0)
 		return false;
 
 	/*
@@ -3746,7 +3747,7 @@  intel_dp_get_dpcd(struct intel_dp *intel_dp)
 	 * a member variable in intel_dp will track any changes
 	 * between short pulse interrupts.
 	 */
-	intel_dp->sink_count = DP_GET_SINK_COUNT(intel_dp->sink_count);
+	intel_dp->sink_count = DP_GET_SINK_COUNT(sink_count);
 
 	/*
 	 * SINK_COUNT == 0 and DOWNSTREAM_PORT_PRESENT == 1 implies that

Comments

On Thu, Apr 06, 2017 at 04:44:17PM +0300, Jani Nikula wrote:
> Don't clobber intel_dp->sink_count with the raw value.
> 
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 81682fd2804b..3c5c80da9ea3 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3728,6 +3728,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
>  static bool
>  intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  {
> +	u8 sink_count;
> +
>  	if (!intel_dp_read_dpcd(intel_dp))
>  		return false;
>  
> @@ -3737,8 +3739,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  		intel_dp_set_common_rates(intel_dp);
>  	}
>  
> -	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_SINK_COUNT,
> -			      &intel_dp->sink_count) <= 0)
> +	if (drm_dp_dpcd_readb(&intel_dp->aux, DP_SINK_COUNT, &sink_count) <= 0)
>  		return false;
>  
>  	/*
> @@ -3746,7 +3747,7 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  	 * a member variable in intel_dp will track any changes
>  	 * between short pulse interrupts.
>  	 */
> -	intel_dp->sink_count = DP_GET_SINK_COUNT(intel_dp->sink_count);
> +	intel_dp->sink_count = DP_GET_SINK_COUNT(sink_count);
>  
>  	/*
>  	 * SINK_COUNT == 0 and DOWNSTREAM_PORT_PRESENT == 1 implies that
> -- 
> 2.1.4
On Thu, 06 Apr 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Apr 06, 2017 at 04:44:17PM +0300, Jani Nikula wrote:
>> Don't clobber intel_dp->sink_count with the raw value.
>> 
>> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thanks for the reviews, pushed patches 1-9 to drm-intel-next-queued.

BR,
Jani.
Thanks Jani for pushing patches 1-9.
Now we just need review on Patch 10 (Validate cached link rate and lane count), may
Be Ville can review that. I have submitted new revision based on his comments already.
 
And Patch 11 already has your R-b.

Regards
Manasi

On Thu, 06 Apr 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Apr 06, 2017 at 04:44:17PM +0300, Jani Nikula wrote:

>> Don't clobber intel_dp->sink_count with the raw value.

>> 

>> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

>

> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>


Thanks for the reviews, pushed patches 1-9 to drm-intel-next-queued.

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Technology Center