On 16/05/2025 13:16, Jani Nikula wrote:
The workqueue init and destroy belongs in display. Move it.

Signed-off-by: Jani Nikula <[email protected]>

Reviewed-by: Matthew Auld <[email protected]>

---
  .../gpu/drm/i915/display/intel_display_driver.c  | 11 ++++++++++-
  drivers/gpu/drm/i915/i915_driver.c               | 13 +------------
  drivers/gpu/drm/xe/display/xe_display.c          | 16 +---------------
  3 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c 
b/drivers/gpu/drm/i915/display/intel_display_driver.c
index 411fe7b918a7..e40f1935323a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -243,10 +243,16 @@ int intel_display_driver_probe_noirq(struct intel_display 
*display)
intel_dmc_init(display); + display->hotplug.dp_wq = alloc_ordered_workqueue("intel-dp", 0);
+       if (!display->hotplug.dp_wq) {
+               ret = -ENOMEM;
+               goto cleanup_vga_client_pw_domain_dmc;
+       }
+
        display->wq.modeset = alloc_ordered_workqueue("i915_modeset", 0);
        if (!display->wq.modeset) {
                ret = -ENOMEM;
-               goto cleanup_vga_client_pw_domain_dmc;
+               goto cleanup_wq_dp;
        }
display->wq.flip = alloc_workqueue("i915_flip", WQ_HIGHPRI |
@@ -296,6 +302,8 @@ int intel_display_driver_probe_noirq(struct intel_display 
*display)
        destroy_workqueue(display->wq.flip);
  cleanup_wq_modeset:
        destroy_workqueue(display->wq.modeset);
+cleanup_wq_dp:
+       destroy_workqueue(display->hotplug.dp_wq);
  cleanup_vga_client_pw_domain_dmc:
        intel_dmc_fini(display);
        intel_power_domains_driver_remove(display);
@@ -631,6 +639,7 @@ void intel_display_driver_remove_noirq(struct intel_display 
*display)
intel_gmbus_teardown(display); + destroy_workqueue(display->hotplug.dp_wq);
        destroy_workqueue(display->wq.flip);
        destroy_workqueue(display->wq.modeset);
        destroy_workqueue(display->wq.cleanup);
diff --git a/drivers/gpu/drm/i915/i915_driver.c 
b/drivers/gpu/drm/i915/i915_driver.c
index 5c69d14a7673..950b7ad8d675 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -115,8 +115,6 @@ static const struct drm_driver i915_drm_driver;
static int i915_workqueues_init(struct drm_i915_private *dev_priv)
  {
-       struct intel_display *display = dev_priv->display;
-
        /*
         * The i915 workqueue is primarily used for batched retirement of
         * requests (and thus managing bo) once the task has been completed
@@ -135,10 +133,6 @@ static int i915_workqueues_init(struct drm_i915_private 
*dev_priv)
        if (dev_priv->wq == NULL)
                goto out_err;
- display->hotplug.dp_wq = alloc_ordered_workqueue("i915-dp", 0);
-       if (!display->hotplug.dp_wq)
-               goto out_free_wq;
-
        /*
         * The unordered i915 workqueue should be used for all work
         * scheduling that do not require running in order, which used
@@ -147,12 +141,10 @@ static int i915_workqueues_init(struct drm_i915_private 
*dev_priv)
         */
        dev_priv->unordered_wq = alloc_workqueue("i915-unordered", 0, 0);
        if (dev_priv->unordered_wq == NULL)
-               goto out_free_dp_wq;
+               goto out_free_wq;
return 0; -out_free_dp_wq:
-       destroy_workqueue(display->hotplug.dp_wq);
  out_free_wq:
        destroy_workqueue(dev_priv->wq);
  out_err:
@@ -163,10 +155,7 @@ static int i915_workqueues_init(struct drm_i915_private 
*dev_priv)
static void i915_workqueues_cleanup(struct drm_i915_private *dev_priv)
  {
-       struct intel_display *display = dev_priv->display;
-
        destroy_workqueue(dev_priv->unordered_wq);
-       destroy_workqueue(display->hotplug.dp_wq);
        destroy_workqueue(dev_priv->wq);
  }
diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index 9513b03847a8..b0f5624177bd 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -83,14 +83,6 @@ static void unset_display_features(struct xe_device *xe)
        xe->drm.driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC);
  }
-static void display_destroy(struct drm_device *dev, void *dummy)
-{
-       struct xe_device *xe = to_xe_device(dev);
-       struct intel_display *display = xe->display;
-
-       destroy_workqueue(display->hotplug.dp_wq);
-}
-
  /**
   * xe_display_create - create display struct
   * @xe: XE device instance
@@ -105,15 +97,9 @@ static void display_destroy(struct drm_device *dev, void 
*dummy)
  int xe_display_create(struct xe_device *xe)
  {
        /* TODO: Allocate display dynamically. */
-       struct intel_display *display = &xe->__display;
-
        xe->display = &xe->__display;
- display->hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
-       if (!display->hotplug.dp_wq)
-               return -ENOMEM;
-
-       return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
+       return 0;
  }
static void xe_display_fini_early(void *arg)

Reply via email to