aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tmp401.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-04-14 07:39:46 -0400
committerGuenter Roeck <linux@roeck-us.net>2013-04-21 11:27:28 -0400
commit8eb6d90fec24244f80bba018d955413ea6117a34 (patch)
tree3e6445966e8913bf43406feaf8a8efa5e4e9edbe /drivers/hwmon/tmp401.c
parent14f2a6654dd42d60645071de26d17d0bced63a7d (diff)
hwmon: (tmp401) Reset valid flag when resetting temperature history
Cached data is no longer valid after resetting the temperature history. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/tmp401.c')
-rw-r--r--drivers/hwmon/tmp401.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index 4d306b29ba71..061146288e41 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -351,6 +351,8 @@ static ssize_t store_temp_crit_hyst(struct device *dev, struct device_attribute
351static ssize_t reset_temp_history(struct device *dev, 351static ssize_t reset_temp_history(struct device *dev,
352 struct device_attribute *devattr, const char *buf, size_t count) 352 struct device_attribute *devattr, const char *buf, size_t count)
353{ 353{
354 struct i2c_client *client = to_i2c_client(dev);
355 struct tmp401_data *data = i2c_get_clientdata(client);
354 long val; 356 long val;
355 357
356 if (kstrtol(buf, 10, &val)) 358 if (kstrtol(buf, 10, &val))
@@ -362,8 +364,10 @@ static ssize_t reset_temp_history(struct device *dev,
362 val); 364 val);
363 return -EINVAL; 365 return -EINVAL;
364 } 366 }
365 i2c_smbus_write_byte_data(to_i2c_client(dev), 367 mutex_lock(&data->update_lock);
366 TMP401_TEMP_MSB_WRITE[5][0], val); 368 i2c_smbus_write_byte_data(client, TMP401_TEMP_MSB_WRITE[5][0], val);
369 data->valid = 0;
370 mutex_unlock(&data->update_lock);
367 371
368 return count; 372 return count;
369} 373}