Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <linux@roeck-us.net>

+1 -12
+1 -12
drivers/hwmon/tmp464.c
··· 13 13 #include <linux/i2c.h> 14 14 #include <linux/init.h> 15 15 #include <linux/module.h> 16 - #include <linux/mutex.h> 17 16 #include <linux/of.h> 18 17 #include <linux/regmap.h> 19 18 #include <linux/slab.h> ··· 91 92 92 93 struct tmp464_data { 93 94 struct regmap *regmap; 94 - struct mutex update_lock; 95 95 int channels; 96 96 s16 config_orig; 97 97 u16 open_reg; ··· 170 172 * complete. That means we have to cache the value internally 171 173 * for one measurement cycle and report the cached value. 172 174 */ 173 - mutex_lock(&data->update_lock); 174 175 if (!data->valid || time_after(jiffies, data->last_updated + 175 176 msecs_to_jiffies(data->update_interval))) { 176 177 err = regmap_read(regmap, TMP464_REMOTE_OPEN_REG, &regval); 177 178 if (err < 0) 178 - goto unlock; 179 + break; 179 180 data->open_reg = regval; 180 181 data->last_updated = jiffies; 181 182 data->valid = true; 182 183 } 183 184 *val = !!(data->open_reg & BIT(channel + 7)); 184 - unlock: 185 - mutex_unlock(&data->update_lock); 186 185 break; 187 186 case hwmon_temp_max_hyst: 188 187 regs[0] = TMP464_THERM_LIMIT[channel]; ··· 340 345 struct tmp464_data *data = dev_get_drvdata(dev); 341 346 int err; 342 347 343 - mutex_lock(&data->update_lock); 344 - 345 348 switch (type) { 346 349 case hwmon_chip: 347 350 err = tmp464_chip_write(data, attr, channel, val); ··· 351 358 err = -EOPNOTSUPP; 352 359 break; 353 360 } 354 - 355 - mutex_unlock(&data->update_lock); 356 361 357 362 return err; 358 363 } ··· 648 657 data = devm_kzalloc(dev, sizeof(struct tmp464_data), GFP_KERNEL); 649 658 if (!data) 650 659 return -ENOMEM; 651 - 652 - mutex_init(&data->update_lock); 653 660 654 661 data->channels = (int)(unsigned long)i2c_get_match_data(client); 655 662