There are fields 'last_hwmon_state' and 'last_thermal_state' in the structure 'emc2305_cdev_data', which respectively store the cooling state set by the 'hwmon' and 'thermal' subsystem, and the driver author hopes that if the state set by 'hwmon' is lower than the value set by 'thermal', the driver will just save it without actually setting the pwm. Currently, the 'last_thermal_state' also be updated by 'hwmon', which will cause the cooling state to never be set to a lower value. This patch fixes that. Signed-off-by: Xingjiang Qiao <nanpuyue@xxxxxxxxx> --- drivers/hwmon/emc2305.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index 4df84065cbfb..f51760f8aa85 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -398,11 +398,9 @@ emc2305_write(struct device *dev, enum hwmon_sensor_types type, u32 attr, int ch * Update PWM only in case requested state is not less than the * last thermal state. */ - if (data->cdev_data[cdev_idx].last_hwmon_state >= + if (data->cdev_data[cdev_idx].last_hwmon_state < data->cdev_data[cdev_idx].last_thermal_state) - return emc2305_set_cur_state(data->cdev_data[cdev_idx].cdev, - data->cdev_data[cdev_idx].last_hwmon_state); - return 0; + return 0; } return emc2305_set_pwm(dev, val, channel); default: -- 2.38.1