Commit cc8ba5f3 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Greg Kroah-Hartman

ACPI/PCI: PM: Add missing wakeup.flags.valid checks

[ Upstream commit 9a51c6b1 ]

Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
current ACPI wakeup configuration of the device matches what is
expected as far as system wakeup from sleep states is concerned, as
reflected by the device_may_wakeup() return value for the device.

However, they only should do that if wakeup.flags.valid is set for
the device's ACPI companion, because otherwise the wakeup.prepare_count
value for it is meaningless.

Add the missing wakeup.flags.valid checks to these functions.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ff6f3ec6
...@@ -949,8 +949,8 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev) ...@@ -949,8 +949,8 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev)
u32 sys_target = acpi_target_system_state(); u32 sys_target = acpi_target_system_state();
int ret, state; int ret, state;
if (!pm_runtime_suspended(dev) || !adev || if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid &&
device_may_wakeup(dev) != !!adev->wakeup.prepare_count) device_may_wakeup(dev) != !!adev->wakeup.prepare_count))
return true; return true;
if (sys_target == ACPI_STATE_S0) if (sys_target == ACPI_STATE_S0)
......
...@@ -666,7 +666,8 @@ static bool acpi_pci_need_resume(struct pci_dev *dev) ...@@ -666,7 +666,8 @@ static bool acpi_pci_need_resume(struct pci_dev *dev)
if (!adev || !acpi_device_power_manageable(adev)) if (!adev || !acpi_device_power_manageable(adev))
return false; return false;
if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count) if (adev->wakeup.flags.valid &&
device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
return true; return true;
if (acpi_target_system_state() == ACPI_STATE_S0) if (acpi_target_system_state() == ACPI_STATE_S0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment