OSDN Git Service

intel-hid: intel-vbtn: Avoid leaking wakeup_mode set
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 8 Aug 2019 09:39:17 +0000 (11:39 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 9 Aug 2019 08:14:28 +0000 (10:14 +0200)
commit31eb845718398f9bc9f6fbe1aca675f4e6284392
tree5ab05d27b9c827d8efd47f3db8320b568adc67f5
parentac9eafbe930abb589e9289842a99cc575cadb854
intel-hid: intel-vbtn: Avoid leaking wakeup_mode set

Both intel-hid and intel-vbtn set a wakeup_mode flag causing them
to behave in a special way during system suspend and while suspended
in their "prepare" PM callbacks and clear it in their "resume" PM
callbacks.  That may cause the wakeup_mode flag to remain set after
a system suspend failure (if some other driver's "suspend" callback
returns an error before the "suspend" callback of either intel-hid
or intel-vbtn is invoked).

After commit 10a08fd65ec1 ("ACPI: PM: Set up EC GPE for system wakeup
from drivers that need it") that also affects the "wakeup mask" bit
of the EC GPE, which may not be cleared after a failing system
suspend.

Fix this issue by adding "complete" PM callbacks to intel-hid and
intel-vbtn to clear the wakeup_mode flag and the "wakeup mask" bit
of the EC GPE if they have not been cleared earlier.

Fixes: 10a08fd65ec1 ("ACPI: PM: Set up EC GPE for system wakeup from drivers that need it")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/intel-hid.c
drivers/platform/x86/intel-vbtn.c