]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/pm: Do early initialization in init_early()
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 26 May 2026 19:54:52 +0000 (21:54 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 27 May 2026 10:51:30 +0000 (12:51 +0200)
There is no need nor gain in splitting mutex or list initializations
between two init functions as all of this is just pure software state
and all this could be done at once.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patch.msgid.link/20260526195452.20545-8-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_pm.c

index 5d1a3a26cb6e596d202005ea2316b243fac36afe..99562f691080bf22ceb01b419fbdc3482b9e3ee9 100644 (file)
@@ -363,6 +363,9 @@ int xe_pm_init_early(struct xe_device *xe)
 {
        int err;
 
+       init_completion(&xe->pm_block);
+       complete_all(&xe->pm_block);
+       INIT_LIST_HEAD(&xe->rebind_resume_list);
        INIT_LIST_HEAD(&xe->mem_access.vram_userfault.list);
 
        err = drmm_mutex_init(&xe->drm, &xe->mem_access.vram_userfault.lock);
@@ -373,6 +376,10 @@ int xe_pm_init_early(struct xe_device *xe)
        if (err)
                return err;
 
+       err = drmm_mutex_init(&xe->drm, &xe->rebind_resume_lock);
+       if (err)
+               return err;
+
        return 0;
 }
 ALLOW_ERROR_INJECTION(xe_pm_init_early, ERRNO); /* See xe_pci_probe() */
@@ -484,14 +491,6 @@ int xe_pm_init(struct xe_device *xe)
        if (err)
                return err;
 
-       err = drmm_mutex_init(&xe->drm, &xe->rebind_resume_lock);
-       if (err)
-               goto err_unregister;
-
-       init_completion(&xe->pm_block);
-       complete_all(&xe->pm_block);
-       INIT_LIST_HEAD(&xe->rebind_resume_list);
-
        /* For now suspend/resume is only allowed with GuC */
        if (!xe_device_uc_enabled(xe))
                return 0;