[Intel-gfx] [PATCH 1/4] drm/i915: export assert_device_not_suspended

Chris Wilson chris at chris-wilson.co.uk
Mon Nov 9 12:52:53 PST 2015


On Mon, Nov 09, 2015 at 08:20:08PM +0200, Imre Deak wrote:
> We should use the same assert in more places, so export it. Move it to
> intel_runtime_pm.c at the same time, since that's a more logical place
> for it.
> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/intel_drv.h        | 2 ++
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 6 ++++++
>  drivers/gpu/drm/i915/intel_uncore.c     | 7 -------
>  3 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index f9089df..373cc07 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1415,6 +1415,8 @@ void intel_display_power_get(struct drm_i915_private *dev_priv,
>  			     enum intel_display_power_domain domain);
>  void intel_display_power_put(struct drm_i915_private *dev_priv,
>  			     enum intel_display_power_domain domain);
> +
> +void assert_device_not_suspended(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_get(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_put(struct drm_i915_private *dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index b42506b..0d4a03b 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -2120,6 +2120,12 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume)
>  	power_domains->initializing = false;
>  }
>  
> +void assert_device_not_suspended(struct drm_i915_private *dev_priv)
> +{
> +	WARN_ONCE(HAS_RUNTIME_PM(dev_priv->dev) && dev_priv->pm.suspended,

Can just be HAS_RUNTIME_PM(dev_priv).

Can we fix HAS_RUNTIME_PM not to be an ever-growing list but a nice
little feature flag?

{
  if (!HAS_RUNTIME_PM(dev_priv))
	return;

  WARN_ONCE(dev_priv->pm.suspended, "Device suspended during HW access");
}

The little extra information would be nice in the error message, but not
convinced the extra whitespace is that helpful.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list