]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (ina2xx) Use scoped_guard() to acquire the subsystem lock
authorGuenter Roeck <linux@roeck-us.net>
Wed, 13 May 2026 14:17:03 +0000 (07:17 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 9 Jun 2026 15:23:00 +0000 (08:23 -0700)
Use scoped_guard() instead of hwmon_lock() / hwmon_unlock() to acquire
and release the hardware monitoring subsystem lock.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ina2xx.c

index 32bf4595bcb482e7192e70de93cfa8cdce20c89e..c4742e84b999d4079a92d6152c720de8b679874c 100644 (file)
@@ -875,11 +875,11 @@ static ssize_t shunt_resistor_store(struct device *dev,
        if (status < 0)
                return status;
 
-       hwmon_lock(dev);
-       status = ina2xx_set_shunt(data, val);
-       hwmon_unlock(dev);
-       if (status < 0)
-               return status;
+       scoped_guard(hwmon_lock, dev) {
+               status = ina2xx_set_shunt(data, val);
+               if (status < 0)
+                       return status;
+       }
        return count;
 }