]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (tmp401) Rely on subsystem locking
authorGuenter Roeck <linux@roeck-us.net>
Sun, 8 Jun 2025 04:01:11 +0000 (21:01 -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/tmp401.c

index 02c5a3bb1071cb1445d12ee1e670190dffb03c69..fbaa34973694f24a32b4deb7a4fa1e7ea57b1c3b 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/hwmon.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/mutex.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 
@@ -107,7 +106,6 @@ MODULE_DEVICE_TABLE(i2c, tmp401_id);
 struct tmp401_data {
        struct i2c_client *client;
        struct regmap *regmap;
-       struct mutex update_lock;
        enum chips kind;
 
        bool extended_range;
@@ -357,7 +355,6 @@ static int tmp401_temp_write(struct device *dev, u32 attr, int channel,
        unsigned int regval;
        int reg, ret, temp;
 
-       mutex_lock(&data->update_lock);
        switch (attr) {
        case hwmon_temp_min:
        case hwmon_temp_max:
@@ -386,7 +383,6 @@ static int tmp401_temp_write(struct device *dev, u32 attr, int channel,
                ret = -EOPNOTSUPP;
                break;
        }
-       mutex_unlock(&data->update_lock);
        return ret;
 }
 
@@ -436,7 +432,6 @@ static int tmp401_chip_write(struct device *dev, u32 attr, int channel, long val
        struct regmap *regmap = data->regmap;
        int err;
 
-       mutex_lock(&data->update_lock);
        switch (attr) {
        case hwmon_chip_update_interval:
                err = tmp401_set_convrate(regmap, val);
@@ -456,8 +451,6 @@ static int tmp401_chip_write(struct device *dev, u32 attr, int channel, long val
                err = -EOPNOTSUPP;
                break;
        }
-       mutex_unlock(&data->update_lock);
-
        return err;
 }
 
@@ -685,7 +678,6 @@ static int tmp401_probe(struct i2c_client *client)
                return -ENOMEM;
 
        data->client = client;
-       mutex_init(&data->update_lock);
        data->kind = (uintptr_t)i2c_get_match_data(client);
 
        data->regmap = devm_regmap_init(dev, NULL, data, &tmp401_regmap_config);