[07/13] drm/i915: split intel_modeset_driver_remove() to pre/post irq uninstall

Submitted by Jani Nikula on Sept. 19, 2019, 2:03 p.m.

Details

Message ID 27f91b448f5012a9925368f5cd1cc22b7e2ff4d3.1568901239.git.jani.nikula@intel.com
State New
Headers show
Series "drm/i915: modeset probe/remove path refactoring" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Jani Nikula Sept. 19, 2019, 2:03 p.m.
Split intel_modeset_driver_remove() to two, the part with working irqs
before irq uninstall, and the part after irq uninstall.

The error path in i915_driver_modeset_probe() looks obviously weird
after this, but remains as good or broken as it ever was. No functional
changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 14 ++++++--------
 drivers/gpu/drm/i915/display/intel_display.h |  1 +
 drivers/gpu/drm/i915/i915_drv.c              |  5 +++++
 3 files changed, 12 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 78edb5e66cdb..2c474be4a011 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -17054,21 +17054,19 @@  static void intel_hpd_poll_fini(struct drm_i915_private *i915)
 	drm_connector_list_iter_end(&conn_iter);
 }
 
-void intel_modeset_driver_remove(struct drm_i915_private *i915)
+/* part #1: call before irq uninstall */
+void intel_modeset_driver_remove_irq(struct drm_i915_private *i915)
 {
 	flush_workqueue(i915->flip_wq);
 	flush_workqueue(i915->modeset_wq);
 
 	flush_work(&i915->atomic_helper.free_work);
 	WARN_ON(!llist_empty(&i915->atomic_helper.free_list));
+}
 
-	/*
-	 * Interrupts and polling as the first thing to avoid creating havoc.
-	 * Too much stuff here (turning of connectors, ...) would
-	 * experience fancy races otherwise.
-	 */
-	intel_irq_uninstall(i915);
-
+/* part #2: call after irq uninstall */
+void intel_modeset_driver_remove(struct drm_i915_private *i915)
+{
 	/*
 	 * Due to the hpd irq storm handling the hotplug work can re-arm the
 	 * poll handlers. Hence disable polling after hpd handling is shut down.
diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
index 0405a74b513c..1783f4062fc9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.h
+++ b/drivers/gpu/drm/i915/display/intel_display.h
@@ -574,6 +574,7 @@  void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
 /* modesetting */
 void intel_modeset_init_hw(struct drm_i915_private *i915);
 int intel_modeset_init(struct drm_i915_private *i915);
+void intel_modeset_driver_remove_irq(struct drm_i915_private *i915);
 void intel_modeset_driver_remove(struct drm_i915_private *i915);
 int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv, bool state);
 void intel_display_resume(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index a9ee73b61f4d..f2af3ba24ce9 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -407,6 +407,7 @@  static int i915_driver_modeset_probe(struct drm_i915_private *i915)
 	i915_gem_driver_remove(i915);
 	i915_gem_driver_release(i915);
 cleanup_modeset:
+	intel_modeset_driver_remove_irq(i915);
 	intel_modeset_driver_remove(i915);
 cleanup_irq:
 	intel_irq_uninstall(i915);
@@ -425,6 +426,10 @@  static void i915_driver_modeset_remove(struct drm_i915_private *i915)
 {
 	struct pci_dev *pdev = i915->drm.pdev;
 
+	intel_modeset_driver_remove_irq(i915);
+
+	intel_irq_uninstall(i915);
+
 	intel_modeset_driver_remove(i915);
 
 	intel_bios_driver_remove(i915);

Comments

Quoting Jani Nikula (2019-09-19 15:03:54)
> Split intel_modeset_driver_remove() to two, the part with working irqs
> before irq uninstall, and the part after irq uninstall.
> 
> The error path in i915_driver_modeset_probe() looks obviously weird
> after this, but remains as good or broken as it ever was. No functional
> changes.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Memory says _noirq is used by pm code as having irqs available is the
norm.
-Chris