Commit 3ea9f1f1 authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Rodrigo Vivi

drm/xe/device: Prefer the drm-managed mutex_init

There's inconsistent use of mutex_init(), in xe_device_create(), with
several of them never calling mutex_destroy() in xe_device_destroy().
Migrate all of them to drmm_mutex_init(), so the destroy part is
automatically called.
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230225002138.1759016-2-lucas.demarchi@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent d79bdcdf
......@@ -155,7 +155,6 @@ static void xe_device_destroy(struct drm_device *dev, void *dummy)
struct xe_device *xe = to_xe_device(dev);
destroy_workqueue(xe->ordered_wq);
mutex_destroy(&xe->persitent_engines.lock);
ttm_device_fini(&xe->ttm);
}
......@@ -187,10 +186,10 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
init_waitqueue_head(&xe->ufence_wq);
mutex_init(&xe->usm.lock);
drmm_mutex_init(&xe->drm, &xe->usm.lock);
xa_init_flags(&xe->usm.asid_to_vm, XA_FLAGS_ALLOC1);
mutex_init(&xe->persitent_engines.lock);
drmm_mutex_init(&xe->drm, &xe->persitent_engines.lock);
INIT_LIST_HEAD(&xe->persitent_engines.list);
spin_lock_init(&xe->pinned.lock);
......@@ -200,14 +199,15 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0);
mutex_init(&xe->sb_lock);
drmm_mutex_init(&xe->drm, &xe->sb_lock);
xe->enabled_irq_mask = ~0;
err = drmm_add_action_or_reset(&xe->drm, xe_device_destroy, NULL);
if (err)
goto err_put;
mutex_init(&xe->mem_access.lock);
drmm_mutex_init(&xe->drm, &xe->mem_access.lock);
return xe;
err_put:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment