提交 66561277 编写于 作者: Z Zhang Rui 提交者: Xie XiuQi

ACPI: button: reinitialize button state upon resume

mainline inclusion
from mainline-5.1-rc4
commit 13e96214
category: bugfix
bugzilla: 14744
CVE: NA

-------------------------------------------------

With commit dfa46c50 ("ACPI / button: Fix an issue in
button.lid_init_state=ignore mode"), the lid device is considered to be
not compliant to SW_LID if the Lid state is unchanged when updating it.

This is not wrong, but we overlooked the resume case, where Lid state is
updated unconditionally in the button driver .resume() callback. And this
results in warning message "ACPI: button: The lid device is not compliant
to  SW_LID." after resume, if the machine is suspended with Lid opened and
then resumed with Lid opened.

Fix this by flushing the cached lid state before updating the Lid device
in .resume() callback.

Fixes: dfa46c50 ("ACPI / button: Fix an issue in button.lid_init_state=ignore mode")
Reported-and-tested-by: NZhao Lijian <lijian.zhao@intel.com>
Signed-off-by: NZhang Rui <rui.zhang@intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NYao Hongbo <yaohongbo@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 dc9cb037
...@@ -456,8 +456,11 @@ static int acpi_button_resume(struct device *dev) ...@@ -456,8 +456,11 @@ static int acpi_button_resume(struct device *dev)
struct acpi_button *button = acpi_driver_data(device); struct acpi_button *button = acpi_driver_data(device);
button->suspended = false; button->suspended = false;
if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) {
button->last_state = !!acpi_lid_evaluate_state(device);
button->last_time = ktime_get();
acpi_lid_initialize_state(device); acpi_lid_initialize_state(device);
}
return 0; return 0;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册