On Thu, Jul 28, 2016 at 05:50:38PM +0300, ville.syrjala@xxxxxxxxxxxxxxx wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Currently we re-read a bunch of static eDP panel caps from the DPCD > over and over again. Let's do it only once to save some time and effort. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > static bool > intel_dp_get_dpcd(struct intel_dp *intel_dp) > { > - struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); > - struct drm_device *dev = dig_port->base.base.dev; > - struct drm_i915_private *dev_priv = to_i915(dev); > + bool init_edp_dpcd = is_edp(intel_dp) && > + intel_dp->dpcd[DP_DPCD_REV] == 0; > > if (drm_dp_dpcd_read(&intel_dp->aux, 0x000, intel_dp->dpcd, > sizeof(intel_dp->dpcd)) < 0) > + if (init_edp_dpcd) > + intel_edp_get_dpcd(intel_dp); I have to admit it took me a few passes to realise how this achieves init once. bool intel_dp_dpcd_is_unset(intel_dp) { return intel_dp->dpcd[DP_DPCD_REV] == 0; } Not really sure how else to make it clear to the causal reader that test is only true on the first call. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx