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>
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;
}