Skip to contentSkip to conversation

hwmon: (lm85) Do not update hysteresis

PATCH Superseded Guenter Roeck 2 participants 2 messages Feb 25, 2011 Hardware monitoring

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 3/4 hwmon: (lm85) Do not update hysteresis

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.

---
 drivers/hwmon/lm85.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)
drivers/hwmon/lm85.c +0 -12
index 1a9540a..a2fcf67 100644
@@ -936,18 +936,6 @@ static ssize_t set_temp_auto_temp_min(struct device *dev,
 		((data->zone[nr].range & 0x0f) << 4)
 		| (data->pwm_freq[nr] & 0x07));
 
-/* Update temp_auto_hyst and temp_auto_off */
-	data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG(
-		data->zone[nr].limit) - TEMP_FROM_REG(
-		data->zone[nr].off_desired));
-	if (nr = 0 || nr = 1) {
-		lm85_write_value(client, LM85_REG_AFAN_HYST1,
-			(data->zone[0].hyst << 4)
-			| data->zone[1].hyst);
-	} else {
-		lm85_write_value(client, LM85_REG_AFAN_HYST2,
-			(data->zone[2].hyst << 4));
-	}
 	mutex_unlock(&data->update_lock);
 	return count;
 }
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw

Re: [lm-sensors] [PATCH v3 3/4] hwmon: (lm85) Do not update

Hi Guenter,

Quoted 26 lines · Guenter Roeck

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.

---
 drivers/hwmon/lm85.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)
drivers/hwmon/lm85.c +0 -5
index 1a9540a..a2fcf67 100644
@@ -936,18 +936,6 @@ static ssize_t set_temp_auto_temp_min(struct device *dev,
 		((data->zone[nr].range & 0x0f) << 4)
 		| (data->pwm_freq[nr] & 0x07));
 
-/* Update temp_auto_hyst and temp_auto_off */
-	data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG(
-		data->zone[nr].limit) - TEMP_FROM_REG(
-		data->zone[nr].off_desired));
-	if (nr = 0 || nr = 1) {

drivers/hwmon/lm85.c static ssize_t set_temp_auto_temp_min(struct device *dev, · line 941

Quoted 10 lines
drivers/hwmon/lm85.c +0 -7
-		lm85_write_value(client, LM85_REG_AFAN_HYST1,
-			(data->zone[0].hyst << 4)
-			| data->zone[1].hyst);
-	} else {
-		lm85_write_value(client, LM85_REG_AFAN_HYST2,
-			(data->zone[2].hyst << 4));
-	}
 	mutex_unlock(&data->update_lock);
 	return count;
 }

Your patch is incomplete: you can now get rid of lm85_zone.off_desired altogether.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors