[Intel-gfx] [PATCH 09/11] drm/i915: move more display related probe/remove stuff to display

Jani Nikula jani.nikula at intel.com
Mon Oct 7 15:09:34 UTC 2019


With the intel_display_* prove/remove functions clarified, we can
continue with moving more related calls to the right layer:

- drm_vblank_init()
- intel_bios_init() and intel_bios_driver_remove()
- intel_vga_register() and intel_vga_unregister()
- intel_csr_ucode_init() and intel_csr_ucode_fini()

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 25 ++++++++++++++
 drivers/gpu/drm/i915/i915_drv.c              | 34 +-------------------
 2 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 3e97d4d76900..db79faffa7c7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -63,6 +63,7 @@
 #include "intel_bw.h"
 #include "intel_cdclk.h"
 #include "intel_color.h"
+#include "intel_csr.h"
 #include "intel_display_types.h"
 #include "intel_fbc.h"
 #include "intel_fbdev.h"
@@ -16192,6 +16193,21 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)
 {
 	int ret;
 
+	if (HAS_DISPLAY(i915) && INTEL_DISPLAY_ENABLED(i915)) {
+		ret = drm_vblank_init(&i915->drm,
+				      INTEL_NUM_PIPES(i915));
+		if (ret)
+			goto out;
+	}
+
+	intel_bios_init(i915);
+
+	ret = intel_vga_register(i915);
+	if (ret)
+		goto out;
+
+	intel_csr_ucode_init(i915);
+
 	i915->modeset_wq = alloc_ordered_workqueue("i915_modeset", 0);
 	i915->flip_wq = alloc_workqueue("i915_flip", WQ_HIGHPRI |
 					WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
@@ -16211,6 +16227,9 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)
 	intel_fbc_init(i915);
 
 	return 0;
+
+out:
+	return ret;
 }
 
 /* part #2: call after irq install, but before gem init */
@@ -17138,6 +17157,12 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915)
 	destroy_workqueue(i915->modeset_wq);
 
 	intel_fbc_cleanup_cfb(i915);
+
+	intel_bios_driver_remove(i915);
+
+	intel_vga_unregister(i915);
+
+	intel_csr_ucode_fini(i915);
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index abd8bc0b0544..d092cc130acf 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -272,36 +272,10 @@ intel_teardown_mchbar(struct drm_i915_private *dev_priv)
 /* part #1: call before irq install */
 static int i915_driver_modeset_probe_noirq(struct drm_i915_private *i915)
 {
-	int ret;
-
 	if (i915_inject_probe_failure(i915))
 		return -ENODEV;
 
-	if (HAS_DISPLAY(i915) && INTEL_DISPLAY_ENABLED(i915)) {
-		ret = drm_vblank_init(&i915->drm,
-				      INTEL_NUM_PIPES(i915));
-		if (ret)
-			goto out;
-	}
-
-	intel_bios_init(i915);
-
-	ret = intel_vga_register(i915);
-	if (ret)
-		goto out;
-
-	intel_csr_ucode_init(i915);
-
-	ret = intel_modeset_init_noirq(i915);
-	if (ret)
-		goto cleanup_vga_client;
-
-	return 0;
-
-cleanup_vga_client:
-	intel_vga_unregister(i915);
-out:
-	return ret;
+	return intel_modeset_init_noirq(i915);
 }
 
 /* part #2: call after irq install */
@@ -351,12 +325,6 @@ static void i915_driver_modeset_remove(struct drm_i915_private *i915)
 static void i915_driver_modeset_remove_noirq(struct drm_i915_private *i915)
 {
 	intel_modeset_driver_remove_noirq(i915);
-
-	intel_bios_driver_remove(i915);
-
-	intel_vga_unregister(i915);
-
-	intel_csr_ucode_fini(i915);
 }
 
 static void intel_init_dpio(struct drm_i915_private *dev_priv)
-- 
2.20.1



More information about the Intel-gfx mailing list