ACPI: PM: Turn off unused wakeup power resources
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 Oct 2021 17:01:28 +0000 (19:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:35 +0000 (19:16 +0100)
commit453c3013a586ba7c0991c46d5446feb407867d9e
tree164cdd802721dc45109f4a2822bf97f7afda12b3
parent6500e7148a01763927e346b4e2dc7e969663e45f
ACPI: PM: Turn off unused wakeup power resources

[ Upstream commit 7a63296d6f579a02b2675b4b0fe5b1cd3235e8d3 ]

If an ACPI power resource is found to be "on" during the
initialization of the list of wakeup power resources of a device,
it is reference counted and its wakeup_enabled flag is set, which is
problematic if the deivce in question is the only user of the given
power resource, it is never runtime-suspended and it is not allowed
to wake up the system from sleep, because in that case the given
power resource will stay "on" until the system reboots and energy
will be wasted.

It is better to simply turn off wakeup power resources that are "on"
during the initialization unless their reference counters are not
zero, because that may be the only opportunity to prevent them from
staying in the "on" state all the time.

Fixes: b5d667eb392e ("ACPI / PM: Take unusual configurations of power resources into account")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/power.c