[PATCH 14/65] drm/i915: pass dev_priv explicitly to PORT_HOTPLUG_STAT

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Jun 6 15:40:09 UTC 2024


On Tue, Jun 04, 2024 at 06:25:32PM +0300, Jani Nikula wrote:
> Avoid the implicit dev_priv local variable use, and pass dev_priv
> explicitly to the PORT_HOTPLUG_STAT register macro.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/g4x_dp.c            | 2 +-
>  drivers/gpu/drm/i915/display/intel_crt.c         | 5 +++--
>  drivers/gpu/drm/i915/display/intel_display_irq.c | 2 +-
>  drivers/gpu/drm/i915/display/intel_hotplug_irq.c | 9 ++++++---
>  drivers/gpu/drm/i915/i915_irq.c                  | 5 +++--
>  drivers/gpu/drm/i915/i915_reg.h                  | 2 +-
>  6 files changed, 15 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c
> index 06ec04e667e3..40fee8380a81 100644
> --- a/drivers/gpu/drm/i915/display/g4x_dp.c
> +++ b/drivers/gpu/drm/i915/display/g4x_dp.c
> @@ -1228,7 +1228,7 @@ static bool g4x_digital_port_connected(struct intel_encoder *encoder)
>  		return false;
>  	}
>  
> -	return intel_de_read(dev_priv, PORT_HOTPLUG_STAT) & bit;
> +	return intel_de_read(dev_priv, PORT_HOTPLUG_STAT(dev_priv)) & bit;
>  }
>  
>  static bool ilk_digital_port_connected(struct intel_encoder *encoder)
> diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
> index b7eab52b64b6..808fa8afb164 100644
> --- a/drivers/gpu/drm/i915/display/intel_crt.c
> +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> @@ -609,12 +609,13 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
>  				    "timed out waiting for FORCE_DETECT to go off");
>  	}
>  
> -	stat = intel_de_read(dev_priv, PORT_HOTPLUG_STAT);
> +	stat = intel_de_read(dev_priv, PORT_HOTPLUG_STAT(dev_priv));
>  	if ((stat & CRT_HOTPLUG_MONITOR_MASK) != CRT_HOTPLUG_MONITOR_NONE)
>  		ret = true;
>  
>  	/* clear the interrupt we just generated, if any */
> -	intel_de_write(dev_priv, PORT_HOTPLUG_STAT, CRT_HOTPLUG_INT_STATUS);
> +	intel_de_write(dev_priv, PORT_HOTPLUG_STAT(dev_priv),
> +		       CRT_HOTPLUG_INT_STATUS);
>  
>  	i915_hotplug_interrupt_update(dev_priv, CRT_HOTPLUG_FORCE_DETECT, 0);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_display_irq.c b/drivers/gpu/drm/i915/display/intel_display_irq.c
> index 1674570dff1e..be5b48861baf 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_irq.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_irq.c
> @@ -1377,7 +1377,7 @@ void vlv_display_irq_reset(struct drm_i915_private *dev_priv)
>  		intel_uncore_write(uncore, DPINVGTT, DPINVGTT_STATUS_MASK_VLV);
>  
>  	i915_hotplug_interrupt_update_locked(dev_priv, 0xffffffff, 0);
> -	intel_uncore_rmw(uncore, PORT_HOTPLUG_STAT, 0, 0);
> +	intel_uncore_rmw(uncore, PORT_HOTPLUG_STAT(dev_priv), 0, 0);
>  
>  	i9xx_pipestat_irq_reset(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> index 90fe5f8538e1..a1f07ee69a86 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug_irq.c
> @@ -435,18 +435,21 @@ u32 i9xx_hpd_irq_ack(struct drm_i915_private *dev_priv)
>  	 * bits can itself generate a new hotplug interrupt :(
>  	 */
>  	for (i = 0; i < 10; i++) {
> -		u32 tmp = intel_uncore_read(&dev_priv->uncore, PORT_HOTPLUG_STAT) & hotplug_status_mask;
> +		u32 tmp = intel_uncore_read(&dev_priv->uncore,
> +					    PORT_HOTPLUG_STAT(dev_priv)) & hotplug_status_mask;
>  
>  		if (tmp == 0)
>  			return hotplug_status;
>  
>  		hotplug_status |= tmp;
> -		intel_uncore_write(&dev_priv->uncore, PORT_HOTPLUG_STAT, hotplug_status);
> +		intel_uncore_write(&dev_priv->uncore,
> +				   PORT_HOTPLUG_STAT(dev_priv),
> +				   hotplug_status);
>  	}
>  
>  	drm_WARN_ONCE(&dev_priv->drm, 1,
>  		      "PORT_HOTPLUG_STAT did not clear (0x%08x)\n",
> -		      intel_uncore_read(&dev_priv->uncore, PORT_HOTPLUG_STAT));
> +		      intel_uncore_read(&dev_priv->uncore, PORT_HOTPLUG_STAT(dev_priv)));
>  
>  	return hotplug_status;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 678d632ed043..8059ac7e15fe 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1040,7 +1040,8 @@ static void i915_irq_reset(struct drm_i915_private *dev_priv)
>  
>  	if (I915_HAS_HOTPLUG(dev_priv)) {
>  		i915_hotplug_interrupt_update(dev_priv, 0xffffffff, 0);
> -		intel_uncore_rmw(&dev_priv->uncore, PORT_HOTPLUG_STAT, 0, 0);
> +		intel_uncore_rmw(&dev_priv->uncore,
> +				 PORT_HOTPLUG_STAT(dev_priv), 0, 0);
>  	}
>  
>  	i9xx_pipestat_irq_reset(dev_priv);
> @@ -1149,7 +1150,7 @@ static void i965_irq_reset(struct drm_i915_private *dev_priv)
>  	struct intel_uncore *uncore = &dev_priv->uncore;
>  
>  	i915_hotplug_interrupt_update(dev_priv, 0xffffffff, 0);
> -	intel_uncore_rmw(uncore, PORT_HOTPLUG_STAT, 0, 0);
> +	intel_uncore_rmw(uncore, PORT_HOTPLUG_STAT(dev_priv), 0, 0);
>  
>  	i9xx_pipestat_irq_reset(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 4508c535f320..166c7f4f9c6c 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -1408,7 +1408,7 @@
>  #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV	(0 << 2)
>  #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV	(1 << 2)
>  
> -#define PORT_HOTPLUG_STAT	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61114)
> +#define PORT_HOTPLUG_STAT(dev_priv)	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x61114)
>  /* HDMI/DP bits are g4x+ */
>  #define   PORTD_HOTPLUG_LIVE_STATUS_G4X		(1 << 27)
>  #define   PORTC_HOTPLUG_LIVE_STATUS_G4X		(1 << 28)
> -- 
> 2.39.2
> 


More information about the Intel-gfx mailing list