[Intel-gfx] [PATCH v1] drm/i915: Call intel_edp_init_connector only for eDP.

Jani Nikula jani.nikula at linux.intel.com
Tue Feb 11 13:03:52 UTC 2020


On Tue, 11 Feb 2020, Stanislav Lisovskiy <stanislav.lisovskiy at intel.com> wrote:
> I guess it would still be nice to make the code less confusing
> and do not call eDP specific function, for non-eDP connectors
> just to immediately return true(success) value as a hack.
>
> So simply extracted that check out from this function,
> that we simply don't call it for non-eDP connectors. Bingo.

Fair enough, I guess...

Though I could be persuaded to take a patch for the reverse, because
generally we prefer localized knowledge in the callee than in a
potentially irrelevant place in the caller.

Consider the intel_dp_mst_encoder_init() call in the context of this
patch. We call it, and the function itself decides whether MST init is
relevant or not. But I presume you wouldn't suggest pulling in all the
conditions from there one level higher?

Would your opinion on intel_edp_init_connector() be different if the
conditions were more than just the single intel_dp_is_edp()? Or if we
moved all of eDP support to a separate file?

BR,
Jani.


>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index f4dede6253f8..9bd36197a43d 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -7370,9 +7370,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
>  	intel_wakeref_t wakeref;
>  	struct edid *edid;
>  
> -	if (!intel_dp_is_edp(intel_dp))
> -		return true;
> -
>  	INIT_DELAYED_WORK(&intel_dp->panel_vdd_work, edp_panel_vdd_work);
>  
>  	/*
> @@ -7590,10 +7587,12 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>  	intel_dp_mst_encoder_init(intel_dig_port,
>  				  intel_connector->base.base.id);
>  
> -	if (!intel_edp_init_connector(intel_dp, intel_connector)) {
> -		intel_dp_aux_fini(intel_dp);
> -		intel_dp_mst_encoder_cleanup(intel_dig_port);
> -		goto fail;
> +	if (intel_dp_is_edp(intel_dp)) {
> +		if (!intel_edp_init_connector(intel_dp, intel_connector)) {
> +			intel_dp_aux_fini(intel_dp);
> +			intel_dp_mst_encoder_cleanup(intel_dig_port);
> +			goto fail;
> +		}
>  	}
>  
>  	intel_dp_add_properties(intel_dp, connector);

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list