]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (adt7411) Use scoped_guard() to acquire the subsystem lock
authorGuenter Roeck <linux@roeck-us.net>
Wed, 13 May 2026 14:22:02 +0000 (07:22 -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/adt7411.c

index 5dce2a70172588ac5b5ecaef658687fb780e7ecc..598f3164754461bd58fead6b5028eb436ad4461c 100644 (file)
@@ -169,11 +169,11 @@ static ssize_t adt7411_set_bit(struct device *dev,
        if (ret || flag > 1)
                return -EINVAL;
 
-       hwmon_lock(dev);
-       ret = adt7411_modify_bit(client, s_attr2->index, s_attr2->nr, flag);
-       /* force update */
-       data->next_update = jiffies;
-       hwmon_unlock(dev);
+       scoped_guard(hwmon_lock, dev) {
+               ret = adt7411_modify_bit(client, s_attr2->index, s_attr2->nr, flag);
+               /* force update */
+               data->next_update = jiffies;
+       }
 
        return ret < 0 ? ret : count;
 }