[Intel-gfx] [PATCH 1/2] drm/i915: Create a intel_encoder_find_connector helper function.

Daniel Vetter daniel at ffwll.ch
Tue Aug 23 14:33:07 UTC 2016


On Tue, Aug 23, 2016 at 04:18:07PM +0200, Maarten Lankhorst wrote:
> This makes the code in intel_sanitize_encoder slightly more readable.
> This was meant to be addressed in fd6bbda9c7a4, but I missed that
> review comment.
> 
> Fixes: fd6bbda9c7a4 ("drm/i915: Pass crtc_state and connector_state to encoder functions")
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>

Yeah, prettiness restored!

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 2dd2c0e9ae32..2ae080f947e8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -16423,6 +16423,17 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
>  	return false;
>  }
>  
> +static struct intel_connector *intel_encoder_find_connector(struct intel_encoder *encoder)
> +{
> +	struct drm_device *dev = encoder->base.dev;
> +	struct intel_connector *connector;
> +
> +	for_each_connector_on_encoder(dev, &encoder->base, connector)
> +		return connector;
> +
> +	return NULL;
> +}
> +
>  static bool has_pch_trancoder(struct drm_i915_private *dev_priv,
>  			      enum transcoder pch_transcoder)
>  {
> @@ -16526,7 +16537,6 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  {
>  	struct intel_connector *connector;
>  	struct drm_device *dev = encoder->base.dev;
> -	bool found_connector = false;
>  
>  	/* We need to check both for a crtc link (meaning that the
>  	 * encoder is active and trying to read from a pipe) and the
> @@ -16534,12 +16544,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  	bool has_active_crtc = encoder->base.crtc &&
>  		to_intel_crtc(encoder->base.crtc)->active;
>  
> -	for_each_connector_on_encoder(dev, &encoder->base, connector) {
> -		found_connector = true;
> -		break;
> -	}
> -
> -	if (found_connector && !has_active_crtc) {
> +	connector = intel_encoder_find_connector(encoder);
> +	if (connector && !has_active_crtc) {
>  		DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
>  			      encoder->base.base.id,
>  			      encoder->base.name);
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list