Skip to content

Commit

Permalink
drm/i915/dp: read sink count to a temporary variable first
Browse files Browse the repository at this point in the history
Don't clobber intel_dp->sink_count with the raw value.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/37d3222115172922fcd5ab038238359935bd561f.1491485983.git.jani.nikula@intel.com
  • Loading branch information
jnikula committed Apr 11, 2017
1 parent 010b9b3 commit 27dbefb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpu/drm/i915/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -3737,16 +3739,15 @@ 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;

/*
* Sink count can change between short pulse hpd hence
* 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
Expand Down

0 comments on commit 27dbefb

Please sign in to comment.