]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (lm95245) Rely on subsystem locking
authorGuenter Roeck <linux@roeck-us.net>
Sun, 8 Jun 2025 04:10:12 +0000 (21:10 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 15 Oct 2025 18:02:43 +0000 (11:02 -0700)
Attribute access is now serialized in the hardware monitoring core,
so locking in the driver code is no longer necessary. Drop it.

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

index 3bdc305308479ba3f09a5ddd7f80cdb471a8b8e2..9ed300c6b5f70acd39adf66289f986433ae2c647 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/hwmon.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 
@@ -86,7 +85,6 @@ static const unsigned short normal_i2c[] = {
 /* Client data (each client gets its own) */
 struct lm95245_data {
        struct regmap *regmap;
-       struct mutex update_lock;
        int interval;   /* in msecs */
 };
 
@@ -279,20 +277,16 @@ static int lm95245_write_temp(struct device *dev, u32 attr, int channel,
                ret = regmap_write(regmap, reg, val);
                return ret;
        case hwmon_temp_crit_hyst:
-               mutex_lock(&data->update_lock);
                ret = regmap_read(regmap, LM95245_REG_RW_LOCAL_OS_TCRIT_LIMIT,
                                  &regval);
-               if (ret < 0) {
-                       mutex_unlock(&data->update_lock);
+               if (ret < 0)
                        return ret;
-               }
                /* Clamp to reasonable range to prevent overflow */
                val = clamp_val(val, -1000000, 1000000);
                val = regval - val / 1000;
                val = clamp_val(val, 0, 31);
                ret = regmap_write(regmap, LM95245_REG_RW_COMMON_HYSTERESIS,
                                   val);
-               mutex_unlock(&data->update_lock);
                return ret;
        case hwmon_temp_offset:
                val = clamp_val(val, -128000, 127875);
@@ -332,14 +326,10 @@ static int lm95245_write_chip(struct device *dev, u32 attr, int channel,
                              long val)
 {
        struct lm95245_data *data = dev_get_drvdata(dev);
-       int ret;
 
        switch (attr) {
        case hwmon_chip_update_interval:
-               mutex_lock(&data->update_lock);
-               ret = lm95245_set_conversion_rate(data, val);
-               mutex_unlock(&data->update_lock);
-               return ret;
+               return lm95245_set_conversion_rate(data, val);
        default:
                return -EOPNOTSUPP;
        }
@@ -542,8 +532,6 @@ static int lm95245_probe(struct i2c_client *client)
        if (IS_ERR(data->regmap))
                return PTR_ERR(data->regmap);
 
-       mutex_init(&data->update_lock);
-
        /* Initialize the LM95245 chip */
        ret = lm95245_init_client(data);
        if (ret < 0)