]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/xe/hwmon: Use devm_mutex_init()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 7 Sep 2025 13:42:17 +0000 (15:42 +0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 9 Sep 2025 13:31:13 +0000 (06:31 -0700)
Use devm_mutex_init() instead of hand-writing it.

This saves some LoC, improves readability and saves some space in the
generated .o file.

Before:
======
   text    data     bss     dec     hex filename
  36884   10296      64   47244    b88c drivers/gpu/drm/xe/xe_hwmon.o

After:
=====
   text    data     bss     dec     hex filename
  36651   10224      64   46939    b75b drivers/gpu/drm/xe/xe_hwmon.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Link: https://lore.kernel.org/r/989e96369e9e1f8a44b816962917ec76877c912d.1757252520.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_hwmon.c

index 32a76ae6e9dcfa424b5c91f78f0bbe629115af92..e65382d4426ae4440ab45a6c4c0a824193f9f4c8 100644 (file)
@@ -1294,13 +1294,6 @@ xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon)
                        xe_hwmon_fan_input_read(hwmon, channel, &fan_speed);
 }
 
-static void xe_hwmon_mutex_destroy(void *arg)
-{
-       struct xe_hwmon *hwmon = arg;
-
-       mutex_destroy(&hwmon->hwmon_lock);
-}
-
 int xe_hwmon_register(struct xe_device *xe)
 {
        struct device *dev = xe->drm.dev;
@@ -1319,8 +1312,7 @@ int xe_hwmon_register(struct xe_device *xe)
        if (!hwmon)
                return -ENOMEM;
 
-       mutex_init(&hwmon->hwmon_lock);
-       ret = devm_add_action_or_reset(dev, xe_hwmon_mutex_destroy, hwmon);
+       ret = devm_mutex_init(dev, &hwmon->hwmon_lock);
        if (ret)
                return ret;