From: Prarit Bhargava <prarit@redhat.com> Date: Mon, 10 May 2010 18:52:53 -0400 Subject: [pci] compat header cleanups Message-id: <20100510185037.2781.63537.sendpatchset@prarit.bos.redhat.com> Patchwork-id: 24985 O-Subject: [RHEL5 PATCH 25/27] compat.h cleanup: pci_wake_from_d3() location change Bugzilla: 546740 RH-Acked-by: Jarod Wilson <jarod@redhat.com> >From 6ed4ea175506b9cccf58b97bccc498d26a28065d Mon Sep 17 00:00:00 2001 From: Prarit Bhargava <prarit@redhat.com> Date: Mon, 10 May 2010 09:54:36 -0400 Subject: [PATCH] Move pci_wake_from_d3 to drivers/pci/pci.c Resolves 546740. diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 470312f..7dbf389 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -979,6 +979,27 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) } /** + * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold + * @dev: PCI device to prepare + * @enable: True to enable wake-up event generation; false to disable + * + * Many drivers want the device to wake up the system from D3_hot or D3_cold + * and this function allows them to set that up cleanly - pci_enable_wake() + * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI + * ordering constraints. + * + * This function only returns error code if the device is not capable of + * generating PME# from both D3_hot and D3_cold, and the platform is unable to + * enable wake-up power for it. + */ +int pci_wake_from_d3(struct pci_dev *dev, bool enable) +{ + if (pci_enable_wake(dev, PCI_D3cold, enable)) + return pci_enable_wake(dev, PCI_D3hot, enable); + return 0; +} + +/** * pci_enable_ari - enable ARI forwarding if hardware support it * @dev: the PCI device */ @@ -1900,6 +1921,7 @@ EXPORT_SYMBOL(pci_set_power_state); EXPORT_SYMBOL(pci_save_state); EXPORT_SYMBOL(pci_restore_state); EXPORT_SYMBOL(pci_enable_wake); +EXPORT_SYMBOL(pci_wake_from_d3); EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); /* Quirk info */