]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
hwmon: (it87) Ensure that pwm control cache is current before updating values
authorGuenter Roeck <linux@roeck-us.net>
Wed, 8 Feb 2017 22:02:59 +0000 (14:02 -0800)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 13 Mar 2017 21:20:54 +0000 (15:20 -0600)
BugLink: http://bugs.launchpad.net/bugs/1672544
commit 82dbe987b70042b340f851bdc969a971081e5f02 upstream.

If sensor attributes were never read, the pwm control data has not been
initiialized, which can cause wrong driver behavior. Ensure that cached
data is current before acting on it.

Reported-by: Kevin Folz <kfolz@evertz.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/hwmon/it87.c

index 991e0fce781eeaba5d4f502ca25c1676902ec515..43146162c122b16ca393e047412d382c2a185f11 100644 (file)
@@ -1354,6 +1354,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
                return -EINVAL;
 
        mutex_lock(&data->update_lock);
+       it87_update_pwm_ctrl(data, nr);
        if (has_newer_autopwm(data)) {
                /*
                 * If we are in automatic mode, the PWM duty cycle register
@@ -1466,6 +1467,7 @@ static ssize_t set_pwm_temp_map(struct device *dev,
        }
 
        mutex_lock(&data->update_lock);
+       it87_update_pwm_ctrl(data, nr);
        data->pwm_temp_map[nr] = reg;
        /*
         * If we are in automatic mode, write the temp mapping immediately;