summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_device.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2023-02-25 03:21:37 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:29:43 +0300
commit3ea9f1f1f699c44b3064006b51566ed6accc6a53 (patch)
treedf27c6918f60c68e79e393c90d3738f36d5f5cc5 /drivers/gpu/drm/xe/xe_device.c
parentd79bdcdf06a3b421ac386f3513365f0bf2a5649a (diff)
downloadlinux-3ea9f1f1f699c44b3064006b51566ed6accc6a53.tar.xz
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>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_device.c')
-rw-r--r--drivers/gpu/drm/xe/xe_device.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 00e8ed235353..8a9f1e5ce34d 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -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: