]> git.sur5r.net Git - groeck-it87/commitdiff
Update pwm cached control registers before writing pwm enable
authorGuenter Roeck <linux@roeck-us.net>
Sun, 3 Sep 2017 20:58:47 +0000 (13:58 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 3 Sep 2017 21:01:47 +0000 (14:01 -0700)
If pwmX_enable is written prior to displaying any attributes,
t87_update_pwm_ctrl() is never called, and the cached pwm registers
are never read before written. This results in bad values written
into various registers, and can result in operational failures.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
it87.c

diff --git a/it87.c b/it87.c
index 9bb5d5b3761d5603f3ee2befcf2f97b5bfe1221c..84048028821145678065e995f18a4a7471124483 100644 (file)
--- a/it87.c
+++ b/it87.c
@@ -1623,6 +1623,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *attr,
        }
 
        mutex_lock(&data->update_lock);
+       it87_update_pwm_ctrl(data, nr);
 
        if (val == 0) {
                if (nr < 3 && has_fanctl_onoff(data)) {