[Intel-gfx] [PATCH] drm/i915: Unifying debugfs return codes for unsupported features

Sujaritha sujaritha.sundaresan at intel.com
Tue Nov 28 17:08:09 UTC 2017



On 11/28/2017 07:42 AM, Michal Wajdeczko wrote:
> Instead of trying different seq_puts messages, lets use common
> -ENODEV error code to indicate missing/unsupported feature.

I agree that this is the simplest way to unify the message.

Regards,
Sujaritha
> Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Sagar Arun Kamble <sagar.a.kamble at intel.com>
> Cc: Sujaritha Sundaresan <sujaritha.sundaresan at intel.com>
> ---
>   drivers/gpu/drm/i915/i915_debugfs.c | 47 ++++++++++++++++++-------------------
>   1 file changed, 23 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 2829447..5023acd 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1635,10 +1635,8 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
>   {
>   	struct drm_i915_private *dev_priv = node_to_i915(m->private);
>   
> -	if (!HAS_FBC(dev_priv)) {
> -		seq_puts(m, "FBC unsupported on this chipset\n");
> -		return 0;
> -	}
> +	if (!HAS_FBC(dev_priv))
> +		return -ENODEV;
>   
>   	intel_runtime_pm_get(dev_priv);
>   	mutex_lock(&dev_priv->fbc.lock);
> @@ -1714,10 +1712,8 @@ static int i915_ips_status(struct seq_file *m, void *unused)
>   {
>   	struct drm_i915_private *dev_priv = node_to_i915(m->private);
>   
> -	if (!HAS_IPS(dev_priv)) {
> -		seq_puts(m, "not supported\n");
> -		return 0;
> -	}
> +	if (!HAS_IPS(dev_priv))
> +		return -ENODEV;
>   
>   	intel_runtime_pm_get(dev_priv);
>   
> @@ -1803,10 +1799,8 @@ static int i915_ring_freq_table(struct seq_file *m, void *unused)
>   	int gpu_freq, ia_freq;
>   	unsigned int max_gpu_freq, min_gpu_freq;
>   
> -	if (!HAS_LLC(dev_priv)) {
> -		seq_puts(m, "unsupported on this chipset\n");
> -		return 0;
> -	}
> +	if (!HAS_LLC(dev_priv))
> +		return -ENODEV;
>   
>   	intel_runtime_pm_get(dev_priv);
>   
> @@ -2287,7 +2281,7 @@ static int i915_huc_load_status_info(struct seq_file *m, void *data)
>   	struct drm_printer p;
>   
>   	if (!HAS_HUC_UCODE(dev_priv))
> -		return 0;
> +		return -ENODEV;
>   
>   	p = drm_seq_file_printer(m);
>   	intel_uc_fw_dump(&dev_priv->huc.fw, &p);
> @@ -2305,8 +2299,8 @@ static int i915_guc_load_status_info(struct seq_file *m, void *data)
>   	struct drm_printer p;
>   	u32 tmp, i;
>   
> -	if (!HAS_GUC_UCODE(dev_priv))
> -		return 0;
> +	if (!HAS_GUC(dev_priv))
> +		return -ENODEV;
>   
>   	p = drm_seq_file_printer(m);
>   	intel_uc_fw_dump(&dev_priv->guc.fw, &p);
> @@ -2400,6 +2394,9 @@ static int i915_guc_info(struct seq_file *m, void *data)
>   	struct drm_i915_private *dev_priv = node_to_i915(m->private);
>   	const struct intel_guc *guc = &dev_priv->guc;
>   
> +	if (!HAS_GUC(dev_priv))
> +		return -ENODEV;
> +
>   	if (!check_guc_submission(m))
>   		return 0;
>   
> @@ -2428,6 +2425,9 @@ static int i915_guc_stage_pool(struct seq_file *m, void *data)
>   	unsigned int tmp;
>   	int index;
>   
> +	if (!HAS_GUC(dev_priv))
> +		return -ENODEV;
> +
>   	if (!check_guc_submission(m))
>   		return 0;
>   
> @@ -2482,6 +2482,9 @@ static int i915_guc_log_dump(struct seq_file *m, void *data)
>   	u32 *log;
>   	int i = 0;
>   
> +	if (!HAS_GUC(dev_priv))
> +		return -ENODEV;
> +
>   	if (dump_load_err)
>   		obj = dev_priv->guc.load_err_log;
>   	else if (dev_priv->guc.log.vma)
> @@ -2576,10 +2579,8 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
>   	enum pipe pipe;
>   	bool enabled = false;
>   
> -	if (!HAS_PSR(dev_priv)) {
> -		seq_puts(m, "PSR not supported\n");
> -		return 0;
> -	}
> +	if (!HAS_PSR(dev_priv))
> +		return -ENODEV;
>   
>   	intel_runtime_pm_get(dev_priv);
>   
> @@ -2818,10 +2819,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
>   	struct drm_i915_private *dev_priv = node_to_i915(m->private);
>   	struct intel_csr *csr;
>   
> -	if (!HAS_CSR(dev_priv)) {
> -		seq_puts(m, "not supported\n");
> -		return 0;
> -	}
> +	if (!HAS_CSR(dev_priv))
> +		return -ENODEV;
>   
>   	csr = &dev_priv->csr;
>   
> @@ -3357,7 +3356,7 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
>   	int plane;
>   
>   	if (INTEL_GEN(dev_priv) < 9)
> -		return 0;
> +		return -ENODEV;
>   
>   	drm_modeset_lock_all(dev);
>   



More information about the Intel-gfx mailing list