diff mbox

[01/10] drm/i915: clarify comment about mandatory RPM put/get during driver load/unload

Message ID 1450203038-5150-2-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
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Joonas Lahtinen Dec. 16, 2015, 10:44 a.m. UTC | #1
Hi,

On ti, 2015-12-15 at 20:10 +0200, Imre Deak wrote:
> Signed-off-by: Imre Deak <imre.deak@intel.com>

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

> ---
>  drivers/gpu/drm/i915/intel_runtime_pm.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c
> b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index 2c2151f..9945040 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -1975,9 +1975,15 @@ int intel_power_domains_init(struct
> drm_i915_private *dev_priv)
>   */
>  void intel_power_domains_fini(struct drm_i915_private *dev_priv)
>  {
> -	/* The i915.ko module is still not prepared to be loaded
> when
> +	/*
> +	 * The i915.ko module is still not prepared to be loaded
> when
>  	 * the power well is not enabled, so just enable it in case
> -	 * we're going to unload/reload. */
> +	 * we're going to unload/reload.
+	 * The following also reacquires the RPM reference the core
> passed
> +	 * to the driver during loading, which is dropped in
> +	 * intel_runtime_pm_enable(). We have to hand back the
> control of the
> +	 * device to the core with this reference held.
> +	 */
>  	intel_display_set_init_power(dev_priv, true);
>  
>  	/* Remove the refcount we took to keep power well support
> disabled. */
> @@ -2313,6 +2319,11 @@ void intel_runtime_pm_enable(struct
> drm_i915_private *dev_priv)
>  	pm_runtime_mark_last_busy(device);
>  	pm_runtime_use_autosuspend(device);
>  
> +	/*
> +	 * The core calls the driver load handler with an RPM
> reference held.
> +	 * We drop that here and will reacquire it during unloading
> in
> +	 * intel_power_domains_fini().
> +	 */
>  	pm_runtime_put_autosuspend(device);
>  }
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
index 2c2151f..9945040 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.c
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
@@ -1975,9 +1975,15 @@  int intel_power_domains_init(struct drm_i915_private *dev_priv)
  */
 void intel_power_domains_fini(struct drm_i915_private *dev_priv)
 {
-	/* The i915.ko module is still not prepared to be loaded when
+	/*
+	 * The i915.ko module is still not prepared to be loaded when
 	 * the power well is not enabled, so just enable it in case
-	 * we're going to unload/reload. */
+	 * we're going to unload/reload.
+	 * The following also reacquires the RPM reference the core passed
+	 * to the driver during loading, which is dropped in
+	 * intel_runtime_pm_enable(). We have to hand back the control of the
+	 * device to the core with this reference held.
+	 */
 	intel_display_set_init_power(dev_priv, true);
 
 	/* Remove the refcount we took to keep power well support disabled. */
@@ -2313,6 +2319,11 @@  void intel_runtime_pm_enable(struct drm_i915_private *dev_priv)
 	pm_runtime_mark_last_busy(device);
 	pm_runtime_use_autosuspend(device);
 
+	/*
+	 * The core calls the driver load handler with an RPM reference held.
+	 * We drop that here and will reacquire it during unloading in
+	 * intel_power_domains_fini().
+	 */
 	pm_runtime_put_autosuspend(device);
 }