aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/adm1029.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-07-01 20:29:55 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-07-03 12:45:17 -0400
commit1035a9e3e9c76b64a860a774f5b867d28d34acc2 (patch)
treeaa2be34ac6b4bdf39f41dadb4bba97848624dfe9 /drivers/hwmon/adm1029.c
parentdf86754b746e9a0ff6f863f690b1c01d408e3cdc (diff)
hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div
Writing to fanX_div does not clear the cache. As a result, reading from fanX_div may return the old value for up to two seconds after writing a new value. This patch ensures the fan_div cache is updated in set_fan_div(). Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: stable@vger.kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/adm1029.c')
-rw-r--r--drivers/hwmon/adm1029.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hwmon/adm1029.c b/drivers/hwmon/adm1029.c
index 78339e880bd6..2804571b269e 100644
--- a/drivers/hwmon/adm1029.c
+++ b/drivers/hwmon/adm1029.c
@@ -232,6 +232,9 @@ static ssize_t set_fan_div(struct device *dev,
232 /* Update the value */ 232 /* Update the value */
233 reg = (reg & 0x3F) | (val << 6); 233 reg = (reg & 0x3F) | (val << 6);
234 234
235 /* Update the cache */
236 data->fan_div[attr->index] = reg;
237
235 /* Write value */ 238 /* Write value */
236 i2c_smbus_write_byte_data(client, 239 i2c_smbus_write_byte_data(client,
237 ADM1029_REG_FAN_DIV[attr->index], reg); 240 ADM1029_REG_FAN_DIV[attr->index], reg);