mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
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: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://lore.kernel.org/r/20230225002138.1759016-2-lucas.demarchi@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
d79bdcdf06
commit
3ea9f1f1f6
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user