]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (ina238) Rely on subsystem locking
authorGuenter Roeck <linux@roeck-us.net>
Sun, 7 Sep 2025 18:44:37 +0000 (11:44 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 17 Oct 2025 12:59:13 +0000 (05:59 -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/ina238.c

index 356d19b7675cacf9ae9b1013b160248f1219c4d0..ff67b03189f73ca56e307d821c96c1290fb21da5 100644 (file)
@@ -117,7 +117,6 @@ struct ina238_config {
 struct ina238_data {
        const struct ina238_config *config;
        struct i2c_client *client;
-       struct mutex config_lock;
        struct regmap *regmap;
        u32 rshunt;
        int gain;
@@ -607,31 +606,18 @@ static int ina238_read(struct device *dev, enum hwmon_sensor_types type,
 static int ina238_write(struct device *dev, enum hwmon_sensor_types type,
                        u32 attr, int channel, long val)
 {
-       struct ina238_data *data = dev_get_drvdata(dev);
-       int err;
-
-       mutex_lock(&data->config_lock);
-
        switch (type) {
        case hwmon_in:
-               err = ina238_write_in(dev, attr, channel, val);
-               break;
+               return ina238_write_in(dev, attr, channel, val);
        case hwmon_curr:
-               err = ina238_write_curr(dev, attr, val);
-               break;
+               return ina238_write_curr(dev, attr, val);
        case hwmon_power:
-               err = ina238_write_power_max(dev, val);
-               break;
+               return ina238_write_power_max(dev, val);
        case hwmon_temp:
-               err = ina238_write_temp_max(dev, val);
-               break;
+               return ina238_write_temp_max(dev, val);
        default:
-               err = -EOPNOTSUPP;
-               break;
+               return -EOPNOTSUPP;
        }
-
-       mutex_unlock(&data->config_lock);
-       return err;
 }
 
 static umode_t ina238_is_visible(const void *drvdata,
@@ -757,8 +743,6 @@ static int ina238_probe(struct i2c_client *client)
        /* set the device type */
        data->config = &ina238_config[chip];
 
-       mutex_init(&data->config_lock);
-
        data->regmap = devm_regmap_init_i2c(client, &ina238_regmap_config);
        if (IS_ERR(data->regmap)) {
                dev_err(dev, "failed to allocate register map\n");