Re: [PATCH 1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 05 Oct 2017, Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx> wrote:
> Don't call it when we can do like the other functions and just look at
> port->port. Also rename the intel_digital_port variable to make it
> look like the other functions.

I guess the question is, *which* other functions. A quick rough grep
gives me:

$ grep -ho "intel_digital_port[ *]*[a-zA-Z0-9_]*" $(git ls-files -- drivers/gpu/drm/i915) | sort | uniq -c | sort -rn

     93 intel_digital_port *intel_dig_port
     22 intel_digital_port *dig_port
     18 intel_digital_port *dport
     11 intel_digital_port *port
      5 intel_digital_port_connected
      5 intel_digital_port
      4 intel_digital_port *
      1 intel_digital_port *primary
      1 intel_digital_port *irq_port
      1 intel_digital_port 

I think it's more common to use port for enum port. I'm fine with any of
the top three for struct intel_dig_port.

BR,
Jani.

>
> My main goal here is to prevent the copy-pasters from propagating the
> call to other parts of the code.
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index ca48bce..6fb90fa 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4614,14 +4614,11 @@ static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
>  }
>  
>  static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
> -				       struct intel_digital_port *intel_dig_port)
> +				       struct intel_digital_port *port)
>  {
> -	struct intel_encoder *intel_encoder = &intel_dig_port->base;
> -	enum port port;
>  	u32 bit;
>  
> -	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
> -	switch (port) {
> +	switch (port->port) {
>  	case PORT_A:
>  		bit = BXT_DE_PORT_HP_DDIA;
>  		break;
> @@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
>  		bit = BXT_DE_PORT_HP_DDIC;
>  		break;
>  	default:
> -		MISSING_CASE(port);
> +		MISSING_CASE(port->port);
>  		return false;
>  	}

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux