Skip to contentSkip to conversation

hwmon/smsc47b397: Don't report missing fans as

PATCH New Jean Delvare 1 participant 1 message Jun 23, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon/smsc47b397: Don't report missing fans as

Quoted 14 lines · Simon Farnsworth
Quoted 13 lines · Simon Farnsworth

sensors output:

# sensors
smsc47b397-isa-0480
Adapter: ISA adapter
temp1:       +44°C
temp2:       +53°C
temp3:       +26°C
temp4:      -128°C
fan1:     2011 RPM
fan2:       82 RPM
fan3:     1262 RPM
fan4:     1095 RPM
Quoted 5 lines

(...)

I've now experimented with cpuburn and stopping fans. It looks like 82 RPM is the lowest speed this chip reports, as stopping a fan briefly caused it to report 82 RPM.

Correct, and I consider it a bug in the driver. A stopped or missing fan should really be reported as 0 RPM, not 82. Here's a patch fixing it.

* * * * *

Also protects ourselves against a possible division by zero.

---
 drivers/hwmon/smsc47b397.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/smsc47b397.c +2 -0
@@ -174,6 +174,8 @@ static SENSOR_DEVICE_ATTR(temp4_input, S
    REG: count of 90kHz pulses / revolution */
 static int fan_from_reg(u16 reg)
 {
+	if (reg = 0 || reg = 0xffff)
+		return 0;
 	return 90000 * 60 / reg;
 }
 
Signature · 6 lines
Jean Delvare

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