Skip to content

Commit 4f8ab43

Browse files
author
Guenter Roeck
committed
hwmon: (lm85) Do not update hysteresis and temp_auto_off if auto_temp_min is changed
So far, the driver updates temp_auto_hyst and temp_auto_off if temp_auto_min changes. This may cause problems if temp_auto_off was not configured before configuring temp_auto_min, because one of the variables used (off_desired) is not initialized in this case. To simplify the code, and for consistency with other drivers, no longer update the delta between "min" and "off" until the user sets the "off" value again. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
1 parent bc6db2b commit 4f8ab43

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

drivers/hwmon/lm85.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ struct lm85_zone {
283283
u8 hyst; /* Low limit hysteresis. (0-15) */
284284
u8 range; /* Temp range, encoded */
285285
s8 critical; /* "All fans ON" temp limit */
286-
u8 off_desired; /* Actual "off" temperature specified. Preserved
287-
* to prevent "drift" as other autofan control
288-
* values change.
289-
*/
290286
u8 max_desired; /* Actual "max" temperature specified. Preserved
291287
* to prevent "drift" as other autofan control
292288
* values change.
@@ -892,7 +888,6 @@ static ssize_t set_temp_auto_temp_off(struct device *dev,
892888

893889
mutex_lock(&data->update_lock);
894890
min = TEMP_FROM_REG(data->zone[nr].limit);
895-
data->zone[nr].off_desired = TEMP_TO_REG(val);
896891
data->zone[nr].hyst = HYST_TO_REG(min - val);
897892
if (nr == 0 || nr == 1) {
898893
lm85_write_value(client, LM85_REG_AFAN_HYST1,
@@ -935,18 +930,6 @@ static ssize_t set_temp_auto_temp_min(struct device *dev,
935930
((data->zone[nr].range & 0x0f) << 4)
936931
| (data->pwm_freq[nr] & 0x07));
937932

938-
/* Update temp_auto_hyst and temp_auto_off */
939-
data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG(
940-
data->zone[nr].limit) - TEMP_FROM_REG(
941-
data->zone[nr].off_desired));
942-
if (nr == 0 || nr == 1) {
943-
lm85_write_value(client, LM85_REG_AFAN_HYST1,
944-
(data->zone[0].hyst << 4)
945-
| data->zone[1].hyst);
946-
} else {
947-
lm85_write_value(client, LM85_REG_AFAN_HYST2,
948-
(data->zone[2].hyst << 4));
949-
}
950933
mutex_unlock(&data->update_lock);
951934
return count;
952935
}

0 commit comments

Comments
 (0)