]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.54/acpi-pci-pm-add-missing-wakeup.flags.valid-checks.patch
Linux 5.1.13
[thirdparty/kernel/stable-queue.git] / releases / 4.19.54 / acpi-pci-pm-add-missing-wakeup.flags.valid-checks.patch
1 From bb61347c921a0f1fe5e08b6dcc7f033445373a00 Mon Sep 17 00:00:00 2001
2 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
3 Date: Thu, 16 May 2019 12:42:20 +0200
4 Subject: ACPI/PCI: PM: Add missing wakeup.flags.valid checks
5
6 [ Upstream commit 9a51c6b1f9e0239a9435db036b212498a2a3b75c ]
7
8 Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
9 current ACPI wakeup configuration of the device matches what is
10 expected as far as system wakeup from sleep states is concerned, as
11 reflected by the device_may_wakeup() return value for the device.
12
13 However, they only should do that if wakeup.flags.valid is set for
14 the device's ACPI companion, because otherwise the wakeup.prepare_count
15 value for it is meaningless.
16
17 Add the missing wakeup.flags.valid checks to these functions.
18
19 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
20 Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
21 Signed-off-by: Sasha Levin <sashal@kernel.org>
22 ---
23 drivers/acpi/device_pm.c | 4 ++--
24 drivers/pci/pci-acpi.c | 3 ++-
25 2 files changed, 4 insertions(+), 3 deletions(-)
26
27 diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
28 index a7c2673ffd36..1806260938e8 100644
29 --- a/drivers/acpi/device_pm.c
30 +++ b/drivers/acpi/device_pm.c
31 @@ -948,8 +948,8 @@ static bool acpi_dev_needs_resume(struct device *dev, struct acpi_device *adev)
32 u32 sys_target = acpi_target_system_state();
33 int ret, state;
34
35 - if (!pm_runtime_suspended(dev) || !adev ||
36 - device_may_wakeup(dev) != !!adev->wakeup.prepare_count)
37 + if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid &&
38 + device_may_wakeup(dev) != !!adev->wakeup.prepare_count))
39 return true;
40
41 if (sys_target == ACPI_STATE_S0)
42 diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
43 index f8436d1c4d45..f7218c1673ce 100644
44 --- a/drivers/pci/pci-acpi.c
45 +++ b/drivers/pci/pci-acpi.c
46 @@ -625,7 +625,8 @@ static bool acpi_pci_need_resume(struct pci_dev *dev)
47 if (!adev || !acpi_device_power_manageable(adev))
48 return false;
49
50 - if (device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
51 + if (adev->wakeup.flags.valid &&
52 + device_may_wakeup(&dev->dev) != !!adev->wakeup.prepare_count)
53 return true;
54
55 if (acpi_target_system_state() == ACPI_STATE_S0)
56 --
57 2.20.1
58