Skip to contentSkip to conversation

hwmon: (w83627ehf) Fix writing into fan_stop_time for NCT6775F/NCT6776F

PATCH In review Guenter Roeck 3 participants 4 messages Mar 12, 2012 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/2 hwmon: (w83627ehf) Fix writing into fan_stop_time for NCT6775F/NCT6776F

NCT6775F and NCT6776F have their own set of registers for FAN_STOP_TIME. The correct registers were used to read FAN_STOP_TIME, but writes used the wrong registers. Fix it.

---
 drivers/hwmon/w83627ehf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/w83627ehf.c +1 -1
index 57a31a0..378142c 100644
@@ -1622,7 +1622,7 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
 	val = step_time_to_reg(val, data->pwm_mode[nr]); \
 	mutex_lock(&data->update_lock); \
 	data->reg[nr] = val; \
-	w83627ehf_write_value(data, W83627EHF_REG_##REG[nr], val); \
+	w83627ehf_write_value(data, data->REG_##REG[nr], val); \
 	mutex_unlock(&data->update_lock); \
 	return count; \
 } \
Signature · 7 lines
1.7.5.4


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

Hi Guenter,

Quoted 14 lines · Guenter Roeck

NCT6775F and NCT6776F have their own set of registers for FAN_STOP_TIME. The correct registers were used to read FAN_STOP_TIME, but writes used the wrong registers. Fix it.

---
 drivers/hwmon/w83627ehf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/w83627ehf.c +0 -0
index 57a31a0..378142c 100644

drivers/hwmon/w83627ehf.c store_##reg(struct device *dev, struct device_attribute *attr, \ · line 1628

Quoted 8 lines
drivers/hwmon/w83627ehf.c +1 -1
@@ -1622,7 +1622,7 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
 	val = step_time_to_reg(val, data->pwm_mode[nr]); \
 	mutex_lock(&data->update_lock); \
 	data->reg[nr] = val; \
-	w83627ehf_write_value(data, W83627EHF_REG_##REG[nr], val); \
+	w83627ehf_write_value(data, data->REG_##REG[nr], val); \
 	mutex_unlock(&data->update_lock); \
 	return count; \
 } \

Good catch.

This would seem like a candidate for stable, hm?

As a side note, someone's got to explain to me why these functions are macro-generated when the macro is called only once. It would be a good idea to unfold that code to make it easier to read.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Guenter Roeck
Quoted 28 lines · Jean Delvare

Hi Guenter,

Quoted 14 lines · Guenter Roeck

NCT6775F and NCT6776F have their own set of registers for FAN_STOP_TIME. The correct registers were used to read FAN_STOP_TIME, but writes used the wrong registers. Fix it.

---
 drivers/hwmon/w83627ehf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/w83627ehf.c +0 -0
index 57a31a0..378142c 100644

drivers/hwmon/w83627ehf.c store_##reg(struct device *dev, struct device_attribute *attr, \ · line 1628

Quoted 8 lines
drivers/hwmon/w83627ehf.c +1 -1
@@ -1622,7 +1622,7 @@ store_##reg(struct device *dev, struct device_attribute *attr, \
 	val = step_time_to_reg(val, data->pwm_mode[nr]); \
 	mutex_lock(&data->update_lock); \
 	data->reg[nr] = val; \
-	w83627ehf_write_value(data, W83627EHF_REG_##REG[nr], val); \
+	w83627ehf_write_value(data, data->REG_##REG[nr], val); \
 	mutex_unlock(&data->update_lock); \
 	return count; \
 } \

Good catch.

Quoted 4 lines

This would seem like a candidate for stable, hm?

Yes, definitely.

Quoted 4 lines

As a side note, someone's got to explain to me why these functions are macro-generated when the macro is called only once. It would be a good idea to unfold that code to make it easier to read.

I don't know. Historic, maybe ? I thought about unfolding it, but concluded that it would not be appropriate to do that for a bug fix.

I don't like those macro functions anyway ...

Guenter

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

#3 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck
Quoted 4 lines · Jean Delvare

As a side note, someone's got to explain to me why these functions are macro-generated when the macro is called only once. It would be a good idea to unfold that code to make it easier to read.

I don't know. Historic, maybe ?

Certainly. Probably the driver originally had more attributes but they did not make it upstream.

Quoted 2 lines

I thought about unfolding it, but
concluded that it would not be appropriate to do that for a bug fix.

I agree, that would be a separate patch. If you have time and interest... (I lack the former.)

Quoted 1 line

I don't like those macro functions anyway ...

Nobody does. They were needed before the introduction of struct sensor_device_attribute, what, 7 years ago? We should no longer see anything like that in our drivers these days, but...

Signature · 6 lines
Jean Delvare

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