[Intel-gfx] [PATCH 3/5] drm/i915: Add a cleanup function for i915_modeset_load()
José Roberto de Souza
jose.souza at intel.com
Sat Mar 2 00:49:33 UTC 2019
Lets make i915_driver_unload() easier to read by starting to move
components initialized by i915_modeset_load() to
i915_modeset_unload().
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
drivers/gpu/drm/i915/i915_drv.c | 27 ++++++++++++++++++---------
drivers/gpu/drm/i915/intel_display.c | 2 --
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 90c77fab3d70..cc07259ec946 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -639,6 +639,23 @@ static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
.can_switch = i915_switcheroo_can_switch,
};
+static void i915_modeset_unload(struct drm_device *dev)
+{
+ struct drm_i915_private *dev_priv = to_i915(dev);
+ struct pci_dev *pdev = dev_priv->drm.pdev;
+
+ intel_modeset_cleanup(dev);
+
+ intel_teardown_gmbus(dev_priv);
+
+ intel_bios_cleanup(dev_priv);
+
+ vga_switcheroo_unregister_client(pdev);
+ vga_client_register(pdev, NULL, NULL, NULL);
+
+ intel_csr_ucode_fini(dev_priv);
+}
+
static int i915_modeset_load(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
@@ -1778,7 +1795,6 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent)
void i915_driver_unload(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = to_i915(dev);
- struct pci_dev *pdev = dev_priv->drm.pdev;
disable_rpm_wakeref_asserts(dev_priv);
@@ -1794,14 +1810,7 @@ void i915_driver_unload(struct drm_device *dev)
intel_gvt_cleanup(dev_priv);
- intel_modeset_cleanup(dev);
-
- intel_bios_cleanup(dev_priv);
-
- vga_switcheroo_unregister_client(pdev);
- vga_client_register(pdev, NULL, NULL, NULL);
-
- intel_csr_ucode_fini(dev_priv);
+ i915_modeset_unload(dev);
/* Free error state after interrupts are fully disabled. */
cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 91a8ee611b12..7963348f1c64 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -16393,8 +16393,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
intel_overlay_cleanup(dev_priv);
- intel_teardown_gmbus(dev_priv);
-
destroy_workqueue(dev_priv->modeset_wq);
intel_fbc_cleanup_cfb(dev_priv);
--
2.21.0
More information about the Intel-gfx
mailing list