diff mbox series

[2/3] drm/i915/irq: Move irqs_enabled out of runtime_pm

Message ID 20240912172539.418957-2-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915/irq: Remove duplicated irq_enabled variable | expand

Commit Message

Rodrigo Vivi Sept. 12, 2024, 5:25 p.m. UTC
This information is used in many places and it doesn't have
anything to do with runtime_pm directly. Let's move it to
the driver, where it belongs.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h         |  1 +
 drivers/gpu/drm/i915/i915_irq.c         | 14 +++++++-------
 drivers/gpu/drm/i915/intel_runtime_pm.h |  1 -
 3 files changed, 8 insertions(+), 8 deletions(-)

Comments

Cavitt, Jonathan Sept. 12, 2024, 8:03 p.m. UTC | #1
-----Original Message-----
From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Rodrigo Vivi
Sent: Thursday, September 12, 2024 10:26 AM
To: intel-gfx@lists.freedesktop.org
Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com>
Subject: [PATCH 2/3] drm/i915/irq: Move irqs_enabled out of runtime_pm
> 
> This information is used in many places and it doesn't have
> anything to do with runtime_pm directly. Let's move it to
> the driver, where it belongs.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

I almost think it would be better to swap the ordering of this patch
and the previous one, so that the first patch would move all the
functions over to using the driver version of irqs_enabled, while the
second patch would remove the duplicates.

Or perhaps the two patches could be merged?

Not blocking, just a suggestion.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
-Jonathan Cavitt

> ---
>  drivers/gpu/drm/i915/i915_drv.h         |  1 +
>  drivers/gpu/drm/i915/i915_irq.c         | 14 +++++++-------
>  drivers/gpu/drm/i915/intel_runtime_pm.h |  1 -
>  3 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index aa3000349116..def3ca135406 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -234,6 +234,7 @@ struct drm_i915_private {
>  
>  	/* protects the irq masks */
>  	spinlock_t irq_lock;
> +	bool irqs_enabled;
>  
>  	/* Sideband mailbox protection */
>  	struct mutex sb_lock;
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 9f1a6f692dd1..2c0fdb5e05a6 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1404,14 +1404,14 @@ int intel_irq_install(struct drm_i915_private *dev_priv)
>  	 * interrupts as enabled _before_ actually enabling them to avoid
>  	 * special cases in our ordering checks.
>  	 */
> -	dev_priv->runtime_pm.irqs_enabled = true;
> +	dev_priv->irqs_enabled = true;
>  
>  	intel_irq_reset(dev_priv);
>  
>  	ret = request_irq(irq, intel_irq_handler(dev_priv),
>  			  IRQF_SHARED, DRIVER_NAME, dev_priv);
>  	if (ret < 0) {
> -		dev_priv->runtime_pm.irqs_enabled = false;
> +		dev_priv->irqs_enabled = false;
>  		return ret;
>  	}
>  
> @@ -1437,7 +1437,7 @@ void intel_irq_uninstall(struct drm_i915_private *dev_priv)
>  	 * intel_display_driver_remove() calling us out of sequence.
>  	 * Would be nice if it didn't do that...
>  	 */
> -	if (!dev_priv->runtime_pm.irqs_enabled)
> +	if (!dev_priv->irqs_enabled)
>  		return;
>  
>  	intel_irq_reset(dev_priv);
> @@ -1445,7 +1445,7 @@ void intel_irq_uninstall(struct drm_i915_private *dev_priv)
>  	free_irq(irq, dev_priv);
>  
>  	intel_hpd_cancel_work(dev_priv);
> -	dev_priv->runtime_pm.irqs_enabled = false;
> +	dev_priv->irqs_enabled = false;
>  }
>  
>  /**
> @@ -1458,7 +1458,7 @@ void intel_irq_uninstall(struct drm_i915_private *dev_priv)
>  void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv)
>  {
>  	intel_irq_reset(dev_priv);
> -	dev_priv->runtime_pm.irqs_enabled = false;
> +	dev_priv->irqs_enabled = false;
>  	intel_synchronize_irq(dev_priv);
>  }
>  
> @@ -1471,14 +1471,14 @@ void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv)
>   */
>  void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv)
>  {
> -	dev_priv->runtime_pm.irqs_enabled = true;
> +	dev_priv->irqs_enabled = true;
>  	intel_irq_reset(dev_priv);
>  	intel_irq_postinstall(dev_priv);
>  }
>  
>  bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
>  {
> -	return dev_priv->runtime_pm.irqs_enabled;
> +	return dev_priv->irqs_enabled;
>  }
>  
>  void intel_synchronize_irq(struct drm_i915_private *i915)
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h b/drivers/gpu/drm/i915/intel_runtime_pm.h
> index de3579d399e1..796a2dcb307e 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.h
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.h
> @@ -42,7 +42,6 @@ struct intel_runtime_pm {
>  	atomic_t wakeref_count;
>  	struct device *kdev; /* points to i915->drm.dev */
>  	bool available;
> -	bool irqs_enabled;
>  	bool no_wakeref_tracking;
>  
>  	/*
> -- 
> 2.46.0
> 
>
Andi Shyti Sept. 13, 2024, 9:05 a.m. UTC | #2
Hi Rodrigo,

On Thu, Sep 12, 2024 at 01:25:38PM GMT, Rodrigo Vivi wrote:
> This information is used in many places and it doesn't have
> anything to do with runtime_pm directly. Let's move it to
> the driver, where it belongs.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index aa3000349116..def3ca135406 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -234,6 +234,7 @@  struct drm_i915_private {
 
 	/* protects the irq masks */
 	spinlock_t irq_lock;
+	bool irqs_enabled;
 
 	/* Sideband mailbox protection */
 	struct mutex sb_lock;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 9f1a6f692dd1..2c0fdb5e05a6 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1404,14 +1404,14 @@  int intel_irq_install(struct drm_i915_private *dev_priv)
 	 * interrupts as enabled _before_ actually enabling them to avoid
 	 * special cases in our ordering checks.
 	 */
-	dev_priv->runtime_pm.irqs_enabled = true;
+	dev_priv->irqs_enabled = true;
 
 	intel_irq_reset(dev_priv);
 
 	ret = request_irq(irq, intel_irq_handler(dev_priv),
 			  IRQF_SHARED, DRIVER_NAME, dev_priv);
 	if (ret < 0) {
-		dev_priv->runtime_pm.irqs_enabled = false;
+		dev_priv->irqs_enabled = false;
 		return ret;
 	}
 
@@ -1437,7 +1437,7 @@  void intel_irq_uninstall(struct drm_i915_private *dev_priv)
 	 * intel_display_driver_remove() calling us out of sequence.
 	 * Would be nice if it didn't do that...
 	 */
-	if (!dev_priv->runtime_pm.irqs_enabled)
+	if (!dev_priv->irqs_enabled)
 		return;
 
 	intel_irq_reset(dev_priv);
@@ -1445,7 +1445,7 @@  void intel_irq_uninstall(struct drm_i915_private *dev_priv)
 	free_irq(irq, dev_priv);
 
 	intel_hpd_cancel_work(dev_priv);
-	dev_priv->runtime_pm.irqs_enabled = false;
+	dev_priv->irqs_enabled = false;
 }
 
 /**
@@ -1458,7 +1458,7 @@  void intel_irq_uninstall(struct drm_i915_private *dev_priv)
 void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv)
 {
 	intel_irq_reset(dev_priv);
-	dev_priv->runtime_pm.irqs_enabled = false;
+	dev_priv->irqs_enabled = false;
 	intel_synchronize_irq(dev_priv);
 }
 
@@ -1471,14 +1471,14 @@  void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv)
  */
 void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv)
 {
-	dev_priv->runtime_pm.irqs_enabled = true;
+	dev_priv->irqs_enabled = true;
 	intel_irq_reset(dev_priv);
 	intel_irq_postinstall(dev_priv);
 }
 
 bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
 {
-	return dev_priv->runtime_pm.irqs_enabled;
+	return dev_priv->irqs_enabled;
 }
 
 void intel_synchronize_irq(struct drm_i915_private *i915)
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h b/drivers/gpu/drm/i915/intel_runtime_pm.h
index de3579d399e1..796a2dcb307e 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.h
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.h
@@ -42,7 +42,6 @@  struct intel_runtime_pm {
 	atomic_t wakeref_count;
 	struct device *kdev; /* points to i915->drm.dev */
 	bool available;
-	bool irqs_enabled;
 	bool no_wakeref_tracking;
 
 	/*