Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
[sfrench/cifs-2.6.git] / drivers / pci / pci.c
index 9afad0faa9b65b117c2b096ab979602e7b9a92fa..7fa3cbd742c53bd34a871355320cecc56906277f 100644 (file)
@@ -1275,6 +1275,22 @@ bool pci_check_pme_status(struct pci_dev *dev)
        return ret;
 }
 
        return ret;
 }
 
+/*
+ * Time to wait before the system can be put into a sleep state after reporting
+ * a wakeup event signaled by a PCI device.
+ */
+#define PCI_WAKEUP_COOLDOWN    100
+
+/**
+ * pci_wakeup_event - Report a wakeup event related to a given PCI device.
+ * @dev: Device to report the wakeup event for.
+ */
+void pci_wakeup_event(struct pci_dev *dev)
+{
+       if (device_may_wakeup(&dev->dev))
+               pm_wakeup_event(&dev->dev, PCI_WAKEUP_COOLDOWN);
+}
+
 /**
  * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set.
  * @dev: Device to handle.
 /**
  * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set.
  * @dev: Device to handle.
@@ -1285,8 +1301,10 @@ bool pci_check_pme_status(struct pci_dev *dev)
  */
 static int pci_pme_wakeup(struct pci_dev *dev, void *ign)
 {
  */
 static int pci_pme_wakeup(struct pci_dev *dev, void *ign)
 {
-       if (pci_check_pme_status(dev))
+       if (pci_check_pme_status(dev)) {
                pm_request_resume(&dev->dev);
                pm_request_resume(&dev->dev);
+               pci_wakeup_event(dev);
+       }
        return 0;
 }
 
        return 0;
 }