From: Guenter Roeck Date: Sun, 8 Jun 2025 03:56:22 +0000 (-0700) Subject: hwmon: (tmp464) Rely on subsystem locking X-Git-Tag: v6.19-rc1~148^2~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=965e7381ffcbcc7fef3ceb4a35fbc295f7ad709a;p=thirdparty%2Fkernel%2Flinux.git hwmon: (tmp464) Rely on subsystem locking Attribute access is now serialized in the hardware monitoring core, so locking in the driver is no longer necessary. Drop it. Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/tmp464.c b/drivers/hwmon/tmp464.c index 0f629c6d7695e..98f2576d94c67 100644 --- a/drivers/hwmon/tmp464.c +++ b/drivers/hwmon/tmp464.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -92,7 +91,6 @@ struct tmp464_channel { struct tmp464_data { struct regmap *regmap; - struct mutex update_lock; int channels; s16 config_orig; u16 open_reg; @@ -172,19 +170,16 @@ static int tmp464_temp_read(struct device *dev, u32 attr, int channel, long *val * complete. That means we have to cache the value internally * for one measurement cycle and report the cached value. */ - mutex_lock(&data->update_lock); if (!data->valid || time_after(jiffies, data->last_updated + msecs_to_jiffies(data->update_interval))) { err = regmap_read(regmap, TMP464_REMOTE_OPEN_REG, ®val); if (err < 0) - goto unlock; + break; data->open_reg = regval; data->last_updated = jiffies; data->valid = true; } *val = !!(data->open_reg & BIT(channel + 7)); -unlock: - mutex_unlock(&data->update_lock); break; case hwmon_temp_max_hyst: regs[0] = TMP464_THERM_LIMIT[channel]; @@ -345,8 +340,6 @@ static int tmp464_write(struct device *dev, enum hwmon_sensor_types type, struct tmp464_data *data = dev_get_drvdata(dev); int err; - mutex_lock(&data->update_lock); - switch (type) { case hwmon_chip: err = tmp464_chip_write(data, attr, channel, val); @@ -359,8 +352,6 @@ static int tmp464_write(struct device *dev, enum hwmon_sensor_types type, break; } - mutex_unlock(&data->update_lock); - return err; } @@ -658,8 +649,6 @@ static int tmp464_probe(struct i2c_client *client) if (!data) return -ENOMEM; - mutex_init(&data->update_lock); - data->channels = (int)(unsigned long)i2c_get_match_data(client); data->regmap = devm_regmap_init_i2c(client, &tmp464_regmap_config);