[PATCH v2 13/14] drm/xe/hwmon: Fix mutex destroy
Lucas De Marchi
lucas.demarchi at intel.com
Thu Feb 6 23:23:31 UTC 2025
Since the mutex is used if userspace kept the fd open, it can't be
released together with the dev cleanup and needs to be delayed. Also,
there's no need to add an action just to release the mutex: use the
specific drmm_mutex_init() that should be smarter if mutex_destroy() is
actually a nop.
Cc: Badal Nilawar <badal.nilawar at intel.com>
Cc: Karthik Poosa <karthik.poosa at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
drivers/gpu/drm/xe/xe_hwmon.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_hwmon.c b/drivers/gpu/drm/xe/xe_hwmon.c
index 7f327e3342123..0fc91c184570d 100644
--- a/drivers/gpu/drm/xe/xe_hwmon.c
+++ b/drivers/gpu/drm/xe/xe_hwmon.c
@@ -869,13 +869,6 @@ xe_hwmon_get_preregistration_info(struct xe_device *xe)
xe_hwmon_energy_get(hwmon, channel, &energy);
}
-static void xe_hwmon_mutex_destroy(void *arg)
-{
- struct xe_hwmon *hwmon = arg;
-
- mutex_destroy(&hwmon->hwmon_lock);
-}
-
void xe_hwmon_register(struct xe_device *xe)
{
struct device *dev = xe->drm.dev;
@@ -895,8 +888,7 @@ void xe_hwmon_register(struct xe_device *xe)
xe->hwmon = hwmon;
- mutex_init(&hwmon->hwmon_lock);
- if (devm_add_action_or_reset(dev, xe_hwmon_mutex_destroy, hwmon))
+ if (drmm_mutex_init(&xe->drm, &hwmon->hwmon_lock))
return;
/* There's only one instance of hwmon per device */
--
2.48.1
More information about the Intel-xe
mailing list