Skip to content
Commit fd8feec6 authored by Paul Barker's avatar Paul Barker Committed by Guenter Roeck
Browse files

hwmon: (pwm-fan) Fix RPM calculation



To convert the number of pulses counted into an RPM estimation, we need
to divide by the width of our measurement interval instead of
multiplying by it. If the width of the measurement interval is zero we
don't update the RPM value to avoid dividing by zero.

We also don't need to do 64-bit division, with 32-bits we can handle a
fan running at over 4 million RPM.

Signed-off-by: default avatarPaul Barker <pbarker@konsulko.com>
Link: https://lore.kernel.org/r/20201111164643.7087-1-pbarker@konsulko.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 18e8db7f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment