Further simplification of i915_driver_unregister() requires moving of two
steps, intel_pxp_fini() and intel_gt_driver_unregister(), down, e.g.,
right behind drm_dev_unplug().  Local testing hasn't revealed any issues
with that move, so go for it.

Former placement of intel_gt_driver_unregister() within
i915_driver_unregister() originated from commit 42014f69bb235f ("drm/i915:
Hook up GT power management") while its content has grown significantly
since its introduction.  Placement of intel_pxp_fini() originated from
commit f67986b0119c04 ("drm/i915/pxp: Promote pxp subsystem to top-level
of i915").

Cc: Lucas De Marchi <lucas.demar...@intel.com>
Cc: Chris Wilson <chris.p.wil...@linux.intel.com>
Cc: Andi Shyti <andi.sh...@linux.intel.com>
Cc: Alan Previn <alan.previn.teres.ale...@intel.com>
Signed-off-by: Janusz Krzysztofik <janusz.krzyszto...@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_driver.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_driver.c 
b/drivers/gpu/drm/i915/i915_driver.c
index 7980bb880c7dc..0a07de2a7734b 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -673,7 +673,7 @@ static void i915_driver_unregister(struct drm_i915_private 
*dev_priv)
        unsigned int i;
 
        if (!dev_priv->do_unregister)
-               goto do_pxp_gt;
+               goto do_unplug;
 
        i915_switcheroo_unregister(dev_priv);
 
@@ -682,15 +682,6 @@ static void i915_driver_unregister(struct drm_i915_private 
*dev_priv)
 
        intel_display_driver_unregister(display);
 
-do_pxp_gt:
-       intel_pxp_fini(dev_priv);
-
-       for_each_gt(gt, dev_priv, i)
-               intel_gt_driver_unregister(gt);
-
-       if (!dev_priv->do_unregister)
-               goto do_unplug;
-
        i915_hwmon_unregister(dev_priv);
 
        i915_perf_unregister(dev_priv);
@@ -699,6 +690,11 @@ static void i915_driver_unregister(struct drm_i915_private 
*dev_priv)
 do_unplug:
        drm_dev_unplug(&dev_priv->drm);
 
+       intel_pxp_fini(dev_priv);
+
+       for_each_gt(gt, dev_priv, i)
+               intel_gt_driver_unregister(gt);
+
        i915_pmu_unregister(dev_priv);
        i915_gem_driver_unregister(dev_priv);
 }
-- 
2.48.1

Reply via email to