PCI: Do not skip power-managed bridges in pci_enable_wake()
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 27 Sep 2018 21:53:53 +0000 (16:53 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 2 Oct 2018 21:04:40 +0000 (16:04 -0500)
Commit baecc470d5fd ("PCI / PM: Skip bridges in pci_enable_wake()") changed
pci_enable_wake() so that all bridges are skipped when wakeup is enabled
(or disabled) with the reasoning that bridges can only signal wakeup on
behalf of their subordinate devices.

However, there are bridges that can signal wakeup themselves.  For example
PCIe downstream and root ports supporting hotplug may signal wakeup upon
hotplug event.

For this reason change pci_enable_wake() so that it skips all bridges
except those that we power manage (->bridge_d3 is set).  Those are the ones
that can go into low power states and may need to signal wakeup.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/pci.c

index 4b0b1d0548f0c0fda9b58dcd04f7a3586df55c0a..4a1b1f76dc92257aa4ccc448dc1d27f1f10eed4f 100644 (file)
@@ -2137,10 +2137,13 @@ static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable
        int ret = 0;
 
        /*
-        * Bridges can only signal wakeup on behalf of subordinate devices,
-        * but that is set up elsewhere, so skip them.
+        * Bridges that are not power-manageable directly only signal
+        * wakeup on behalf of subordinate devices which is set up
+        * elsewhere, so skip them. However, bridges that are
+        * power-manageable may signal wakeup for themselves (for example,
+        * on a hotplug event) and they need to be covered here.
         */
-       if (pci_has_subordinate(dev))
+       if (!pci_power_manageable(dev))
                return 0;
 
        /* Don't do the same thing twice in a row for one device. */