[PATCH] hwmon/smsc47b397: Don't report missing fans as spinning at 82 RPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 18 Jun 2007 16:23:53 +0100, Simon Farnsworth wrote:
> Simon Farnsworth wrote:
> > 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
> (...)
> 
> 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.

Signed-off-by: Jean Delvare <khali at linux-fr.org>
---
 drivers/hwmon/smsc47b397.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-2.6.22-rc5.orig/drivers/hwmon/smsc47b397.c	2007-05-13 10:01:15.000000000 +0200
+++ linux-2.6.22-rc5/drivers/hwmon/smsc47b397.c	2007-06-23 14:53:09.000000000 +0200
@@ -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;
 }
 


-- 
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux