diff mbox

[04/10] drm/i915: remove HAS_RUNTIME_PM check from RPM get/put/assert helpers

Message ID 1450203038-5150-5-git-send-email-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Imre Deak Dec. 15, 2015, 6:10 p.m. UTC
We don't really need to check this flag in the get/put/assert helpers,
as on platforms without RPM support we won't ever enable RPM. That means
pm.suspend will be always false and the assert will be always true.

Do this to simplify the code and to let us extend the RPM asserts to all
platforms for a better coverage.

Motivated by Ville.

v2-v3:
- unchanged
v4:
- remove the HAS_RUNTIME_PM check from intel_runtime_pm_enable() too
  made possible by the previous two patches

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v3)
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 12 ------------
 drivers/gpu/drm/i915/intel_uncore.c     |  3 +--
 2 files changed, 1 insertion(+), 14 deletions(-)

Comments

Joonas Lahtinen Dec. 16, 2015, 10:56 a.m. UTC | #1
On ti, 2015-12-15 at 20:10 +0200, Imre Deak wrote:
> We don't really need to check this flag in the get/put/assert
> helpers,
> as on platforms without RPM support we won't ever enable RPM. That
> means
> pm.suspend will be always false and the assert will be always true.
> 
> Do this to simplify the code and to let us extend the RPM asserts to
> all
> platforms for a better coverage.
> 
> Motivated by Ville.
> 
> v2-v3:
> - unchanged
> v4:
> - remove the HAS_RUNTIME_PM check from intel_runtime_pm_enable() too
>   made possible by the previous two patches
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v3)

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 12 ------------
>  drivers/gpu/drm/i915/intel_uncore.c     |  3 +--
>  2 files changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
> b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 342baa9..bca7ca7 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -2237,9 +2237,6 @@ void intel_runtime_pm_get(struct
> drm_i915_private *dev_priv)
>  	struct drm_device *dev = dev_priv->dev;
>  	struct device *device = &dev->pdev->dev;
>  
> -	if (!HAS_RUNTIME_PM(dev))
> -		return;
> -
>  	pm_runtime_get_sync(device);
>  	WARN(dev_priv->pm.suspended, "Device still suspended.\n");
>  }
> @@ -2266,9 +2263,6 @@ void intel_runtime_pm_get_noresume(struct
> drm_i915_private *dev_priv)
>  	struct drm_device *dev = dev_priv->dev;
>  	struct device *device = &dev->pdev->dev;
>  
> -	if (!HAS_RUNTIME_PM(dev))
> -		return;
> -
>  	WARN(dev_priv->pm.suspended, "Getting nosync-ref while
> suspended.\n");
>  	pm_runtime_get_noresume(device);
>  }
> @@ -2286,9 +2280,6 @@ void intel_runtime_pm_put(struct
> drm_i915_private *dev_priv)
>  	struct drm_device *dev = dev_priv->dev;
>  	struct device *device = &dev->pdev->dev;
>  
> -	if (!HAS_RUNTIME_PM(dev))
> -		return;
> -
>  	pm_runtime_mark_last_busy(device);
>  	pm_runtime_put_autosuspend(device);
>  }
> @@ -2308,9 +2299,6 @@ void intel_runtime_pm_enable(struct
> drm_i915_private *dev_priv)
>  	struct drm_device *dev = dev_priv->dev;
>  	struct device *device = &dev->pdev->dev;
>  
> -	if (!HAS_RUNTIME_PM(dev))
> -		return;
> -
>  	pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
>  	pm_runtime_mark_last_busy(device);
>  	pm_runtime_use_autosuspend(device);
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c
> b/drivers/gpu/drm/i915/intel_uncore.c
> index fcf04fe..0226776 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -53,8 +53,7 @@ intel_uncore_forcewake_domain_to_str(const enum
> forcewake_domain_id id)
>  static void
>  assert_device_not_suspended(struct drm_i915_private *dev_priv)
>  {
> -	WARN_ONCE(HAS_RUNTIME_PM(dev_priv->dev) && dev_priv
> ->pm.suspended,
> -		  "Device suspended\n");
> +	WARN_ONCE(dev_priv->pm.suspended, "Device suspended\n");
>  }
>  
>  static inline void
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index 342baa9..bca7ca7 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -2237,9 +2237,6 @@  void intel_runtime_pm_get(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	struct device *device = &dev->pdev->dev;
 
-	if (!HAS_RUNTIME_PM(dev))
-		return;
-
 	pm_runtime_get_sync(device);
 	WARN(dev_priv->pm.suspended, "Device still suspended.\n");
 }
@@ -2266,9 +2263,6 @@  void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	struct device *device = &dev->pdev->dev;
 
-	if (!HAS_RUNTIME_PM(dev))
-		return;
-
 	WARN(dev_priv->pm.suspended, "Getting nosync-ref while suspended.\n");
 	pm_runtime_get_noresume(device);
 }
@@ -2286,9 +2280,6 @@  void intel_runtime_pm_put(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	struct device *device = &dev->pdev->dev;
 
-	if (!HAS_RUNTIME_PM(dev))
-		return;
-
 	pm_runtime_mark_last_busy(device);
 	pm_runtime_put_autosuspend(device);
 }
@@ -2308,9 +2299,6 @@  void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
 	struct drm_device *dev = dev_priv->dev;
 	struct device *device = &dev->pdev->dev;
 
-	if (!HAS_RUNTIME_PM(dev))
-		return;
-
 	pm_runtime_set_autosuspend_delay(device, 10000); /* 10s */
 	pm_runtime_mark_last_busy(device);
 	pm_runtime_use_autosuspend(device);
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index fcf04fe..0226776 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -53,8 +53,7 @@  intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id)
 static void
 assert_device_not_suspended(struct drm_i915_private *dev_priv)
 {
-	WARN_ONCE(HAS_RUNTIME_PM(dev_priv->dev) && dev_priv->pm.suspended,
-		  "Device suspended\n");
+	WARN_ONCE(dev_priv->pm.suspended, "Device suspended\n");
 }
 
 static inline void