hwmon: (ina2xx) Use scoped_guard() to acquire the subsystem lock

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>
This commit is contained in:
Guenter Roeck
2026-05-13 07:17:03 -07:00
parent bf3bd1f587
commit bfca8aba91

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