diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 4db1cf9..7f095c4 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -5329,13 +5329,8 @@ TPACPI_HANDLE(sfan, ec, "SFAN", /* 570 */ */ static void fan_update_desired_level(u8 status) { - if ((status & - (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED)) == 0) { - if (status > 7) - fan_control_desired_level = 7; - else - fan_control_desired_level = status; - } + fan_control_desired_level = status & + (TP_EC_FAN_AUTO | TP_EC_FAN_FULLSPEED | 7); } static int fan_get_status(u8 *status) @@ -5886,6 +5881,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) if (likely(acpi_ec_read(fan_status_offset, &fan_control_initial_status))) { fan_status_access_mode = TPACPI_FAN_RD_TPEC; + fan_update_desired_level(fan_control_initial_status); /* In some ThinkPads, neither the EC nor the ACPI * DSDT initialize the fan status, and it ends up @@ -6025,9 +6021,8 @@ static void fan_resume(void) break; case TPACPI_FAN_WR_ACPI_FANS: case TPACPI_FAN_WR_TPEC: - do_set = ((saved_fan_level & TP_EC_FAN_FULLSPEED) || - (saved_fan_level == 7 && - !(current_level & TP_EC_FAN_FULLSPEED))); + do_set = (current_level != saved_fan_level) && + !(current_level & TP_EC_FAN_FULLSPEED); break; default: return;