[PATCH 34/65] drm/i915: pass dev_priv explicitly to SWF1

Rodrigo Vivi rodrigo.vivi at intel.com
Thu Jun 6 16:03:26 UTC 2024


On Tue, Jun 04, 2024 at 06:25:52PM +0300, Jani Nikula wrote:
> Avoid the implicit dev_priv local variable use, and pass dev_priv
> explicitly to the SWF1 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/i915_reg.h     |  2 +-
>  drivers/gpu/drm/i915/i915_suspend.c | 18 ++++++++++++------
>  2 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 8b379ff60070..81f1b491d7af 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2291,7 +2291,7 @@
>   * [30:32] all
>   */
>  #define SWF0(dev_priv, i)	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x70410 + (i) * 4)
> -#define SWF1(i)	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x71410 + (i) * 4)
> +#define SWF1(dev_priv, i)	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x71410 + (i) * 4)
>  #define SWF3(i)	_MMIO(DISPLAY_MMIO_BASE(dev_priv) + 0x72414 + (i) * 4)
>  #define SWF_ILK(i)	_MMIO(0x4F000 + (i) * 4)
>  
> diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
> index ac8221ae97f3..8a71c1f52cb4 100644
> --- a/drivers/gpu/drm/i915/i915_suspend.c
> +++ b/drivers/gpu/drm/i915/i915_suspend.c
> @@ -42,18 +42,21 @@ static void intel_save_swf(struct drm_i915_private *dev_priv)
>  		for (i = 0; i < 7; i++) {
>  			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
>  								      SWF0(dev_priv, i));
> -			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
> +			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
> +								      SWF1(dev_priv, i));
>  		}
>  		for (i = 0; i < 3; i++)
>  			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv, SWF3(i));
>  	} else if (GRAPHICS_VER(dev_priv) == 2) {
>  		for (i = 0; i < 7; i++)
> -			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
> +			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
> +								      SWF1(dev_priv, i));
>  	} else if (HAS_GMCH(dev_priv)) {
>  		for (i = 0; i < 16; i++) {
>  			dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv,
>  								      SWF0(dev_priv, i));
> -			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
> +			dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv,
> +								      SWF1(dev_priv, i));
>  		}
>  		for (i = 0; i < 3; i++)
>  			dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv, SWF3(i));
> @@ -69,18 +72,21 @@ static void intel_restore_swf(struct drm_i915_private *dev_priv)
>  		for (i = 0; i < 7; i++) {
>  			intel_de_write(dev_priv, SWF0(dev_priv, i),
>  				       dev_priv->regfile.saveSWF0[i]);
> -			intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
> +			intel_de_write(dev_priv, SWF1(dev_priv, i),
> +				       dev_priv->regfile.saveSWF1[i]);
>  		}
>  		for (i = 0; i < 3; i++)
>  			intel_de_write(dev_priv, SWF3(i), dev_priv->regfile.saveSWF3[i]);
>  	} else if (GRAPHICS_VER(dev_priv) == 2) {
>  		for (i = 0; i < 7; i++)
> -			intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
> +			intel_de_write(dev_priv, SWF1(dev_priv, i),
> +				       dev_priv->regfile.saveSWF1[i]);
>  	} else if (HAS_GMCH(dev_priv)) {
>  		for (i = 0; i < 16; i++) {
>  			intel_de_write(dev_priv, SWF0(dev_priv, i),
>  				       dev_priv->regfile.saveSWF0[i]);
> -			intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
> +			intel_de_write(dev_priv, SWF1(dev_priv, i),
> +				       dev_priv->regfile.saveSWF1[i]);
>  		}
>  		for (i = 0; i < 3; i++)
>  			intel_de_write(dev_priv, SWF3(i), dev_priv->regfile.saveSWF3[i]);
> -- 
> 2.39.2
> 


More information about the Intel-gfx mailing list