[PATCH 2/3] drm/i915: Pass intel_display to the encoder suspend/shutdown helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pass intel_display to the encoder suspend/shutdown helpers instead of
drm_i915_private for better isolation. This assumes that HAS_DISPLAY()
will also take an intel_display parameter in the future (or that the
HAS_DISPLAY() check will be moved to a caller of these functions).

Signed-off-by: Imre Deak <imre.deak@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_encoder.c | 22 +++++++++++---------
 drivers/gpu/drm/i915/display/intel_encoder.h |  7 +++----
 drivers/gpu/drm/i915/i915_driver.c           |  6 +++---
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_encoder.c b/drivers/gpu/drm/i915/display/intel_encoder.c
index 8a1dccb893a37..8e73d18a522d4 100644
--- a/drivers/gpu/drm/i915/display/intel_encoder.c
+++ b/drivers/gpu/drm/i915/display/intel_encoder.c
@@ -38,8 +38,9 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela
 			 &encoder->link_check_work, msecs_to_jiffies(delay_ms));
 }
 
-void intel_encoder_suspend_all(struct drm_i915_private *i915)
+void intel_encoder_suspend_all(struct intel_display *display)
 {
+	struct drm_i915_private *i915 = to_i915(display->drm);
 	struct intel_encoder *encoder;
 
 	if (!HAS_DISPLAY(i915))
@@ -49,19 +50,20 @@ void intel_encoder_suspend_all(struct drm_i915_private *i915)
 	 * TODO: check and remove holding the modeset locks if none of
 	 * the encoders depends on this.
 	 */
-	drm_modeset_lock_all(&i915->drm);
-	for_each_intel_encoder(&i915->drm, encoder)
+	drm_modeset_lock_all(display->drm);
+	for_each_intel_encoder(display->drm, encoder)
 		if (encoder->suspend)
 			encoder->suspend(encoder);
-	drm_modeset_unlock_all(&i915->drm);
+	drm_modeset_unlock_all(display->drm);
 
-	for_each_intel_encoder(&i915->drm, encoder)
+	for_each_intel_encoder(display->drm, encoder)
 		if (encoder->suspend_complete)
 			encoder->suspend_complete(encoder);
 }
 
-void intel_encoder_shutdown_all(struct drm_i915_private *i915)
+void intel_encoder_shutdown_all(struct intel_display *display)
 {
+	struct drm_i915_private *i915 = to_i915(display->drm);
 	struct intel_encoder *encoder;
 
 	if (!HAS_DISPLAY(i915))
@@ -71,13 +73,13 @@ void intel_encoder_shutdown_all(struct drm_i915_private *i915)
 	 * TODO: check and remove holding the modeset locks if none of
 	 * the encoders depends on this.
 	 */
-	drm_modeset_lock_all(&i915->drm);
-	for_each_intel_encoder(&i915->drm, encoder)
+	drm_modeset_lock_all(display->drm);
+	for_each_intel_encoder(display->drm, encoder)
 		if (encoder->shutdown)
 			encoder->shutdown(encoder);
-	drm_modeset_unlock_all(&i915->drm);
+	drm_modeset_unlock_all(display->drm);
 
-	for_each_intel_encoder(&i915->drm, encoder)
+	for_each_intel_encoder(display->drm, encoder)
 		if (encoder->shutdown_complete)
 			encoder->shutdown_complete(encoder);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_encoder.h b/drivers/gpu/drm/i915/display/intel_encoder.h
index e6cd74576f78e..3fa5589f0b1ce 100644
--- a/drivers/gpu/drm/i915/display/intel_encoder.h
+++ b/drivers/gpu/drm/i915/display/intel_encoder.h
@@ -6,8 +6,7 @@
 #ifndef __INTEL_ENCODER_H__
 #define __INTEL_ENCODER_H__
 
-struct drm_i915_private;
-
+struct intel_display;
 struct intel_encoder;
 
 void intel_encoder_link_check_init(struct intel_encoder *encoder,
@@ -15,7 +14,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder,
 void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms);
 void intel_encoder_link_check_flush_work(struct intel_encoder *encoder);
 
-void intel_encoder_suspend_all(struct drm_i915_private *i915);
-void intel_encoder_shutdown_all(struct drm_i915_private *i915);
+void intel_encoder_suspend_all(struct intel_display *display);
+void intel_encoder_shutdown_all(struct intel_display *display);
 
 #endif /* __INTEL_ENCODER_H__ */
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index e9e38ed246f66..fb8e9c2fcea53 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -956,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
 	if (HAS_DISPLAY(i915))
 		intel_display_driver_suspend_access(i915);
 
-	intel_encoder_suspend_all(i915);
-	intel_encoder_shutdown_all(i915);
+	intel_encoder_suspend_all(&i915->display);
+	intel_encoder_shutdown_all(&i915->display);
 
 	intel_dmc_suspend(i915);
 
@@ -1040,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 	if (HAS_DISPLAY(dev_priv))
 		intel_display_driver_suspend_access(dev_priv);
 
-	intel_encoder_suspend_all(dev_priv);
+	intel_encoder_suspend_all(&dev_priv->display);
 
 	/* Must be called before GGTT is suspended. */
 	intel_dpt_suspend(dev_priv);
-- 
2.43.3




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux