[Intel-gfx] [PATCH 1/2] drm/i915: Fix compiler warnings for i915_edp_psr_status()

Vivi, Rodrigo rodrigo.vivi at intel.com
Tue Jan 17 18:26:11 UTC 2017



Apparently new gccs are getting more cases. I wonder if CI also have the
old gcc that Vathsala and I have here.

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


On Mon, 2017-01-16 at 13:06 +0000, Chris Wilson wrote:
> Appease both the poor reader and the compiler by rewriting the string
> lookup for EDP_PSR2_STATUS_CTL:
> 
> drivers/gpu/drm/i915/i915_debugfs.c:2662 i915_edp_psr_status() warn: if statement not indented
> 
> Fixes: 6ba1f9e1772f ("drm/i915/psr: report live PSR2 State")
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Jim Bride <jim.bride at linux.intel.com>
> Cc: Vathsala Nagaraju <vathsala.nagaraju at intel.com>
> Cc: Patil Deepti <deepti.patil at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 49 ++++++++++++++++++++-----------------
>  1 file changed, 27 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index b4e66d84fc52..e18683c9ebcb 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2565,6 +2565,29 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_guc_log_control_fops,
>  			i915_guc_log_control_get, i915_guc_log_control_set,
>  			"%lld\n");
>  
> +static const char *psr2_live_status(u32 val)
> +{
> +	static const char * const live_status[] = {
> +		"IDLE",
> +		"CAPTURE",
> +		"CAPTURE_FS",
> +		"SLEEP",
> +		"BUFON_FW",
> +		"ML_UP",
> +		"SU_STANDBY",
> +		"FAST_SLEEP",
> +		"DEEP_SLEEP",
> +		"BUF_ON",
> +		"TG_ON"
> +	};
> +
> +	val = (val & EDP_PSR2_STATUS_STATE_MASK) >> EDP_PSR2_STATUS_STATE_SHIFT;
> +	if (val < ARRAY_SIZE(live_status))
> +		return live_status[val];
> +
> +	return "unknown";
> +}
> +
>  static int i915_edp_psr_status(struct seq_file *m, void *data)
>  {
>  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
> @@ -2640,28 +2663,10 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
>  		seq_printf(m, "Performance_Counter: %u\n", psrperf);
>  	}
>  	if (dev_priv->psr.psr2_support) {
> -		static const char * const live_status[] = {
> -							"IDLE",
> -							"CAPTURE",
> -							"CAPTURE_FS",
> -							"SLEEP",
> -							"BUFON_FW",
> -							"ML_UP",
> -							"SU_STANDBY",
> -							"FAST_SLEEP",
> -							"DEEP_SLEEP",
> -							"BUF_ON",
> -							"TG_ON" };
> -		u8 pos = (I915_READ(EDP_PSR2_STATUS_CTL) &
> -			EDP_PSR2_STATUS_STATE_MASK) >>
> -			EDP_PSR2_STATUS_STATE_SHIFT;
> -
> -		seq_printf(m, "PSR2_STATUS_EDP: %x\n",
> -			I915_READ(EDP_PSR2_STATUS_CTL));
> -
> -		if (pos < ARRAY_SIZE(live_status))
> -		seq_printf(m, "PSR2 live state %s\n",
> -			live_status[pos]);
> +		u32 psr2 = I915_READ(EDP_PSR2_STATUS_CTL);
> +
> +		seq_printf(m, "EDP_PSR2_STATUS_CTL: %x [%s]\n",
> +			   psr2, psr2_live_status(psr2));
>  	}
>  	mutex_unlock(&dev_priv->psr.lock);
>  



More information about the Intel-gfx mailing list