Commit f7b32a86 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI/PM: Run resume fixups before disabling wakeup events

pci_pm_resume() and pci_pm_restore() call pci_pm_default_resume(), which
runs resume fixups before disabling wakeup events:

  static void pci_pm_default_resume(struct pci_dev *pci_dev)
  {
    pci_fixup_device(pci_fixup_resume, pci_dev);
    pci_enable_wake(pci_dev, PCI_D0, false);
  }

pci_pm_runtime_resume() does both of these, but in the opposite order:

  pci_enable_wake(pci_dev, PCI_D0, false);
  pci_fixup_device(pci_fixup_resume, pci_dev);

We should always use the same ordering unless there's a reason to do
otherwise.  Change pci_pm_runtime_resume() to call pci_pm_default_resume()
instead of open-coding this, so the fixups are always done before disabling
wakeup events.

pci_pm_default_resume() is called from pci_pm_runtime_resume(), which is
under #ifdef CONFIG_PM.  If SUSPEND and HIBERNATION are disabled, PM_SLEEP
is disabled also, so move pci_pm_default_resume() from #ifdef
CONFIG_PM_SLEEP to #ifdef CONFIG_PM.

Link: https://lore.kernel.org/r/20191014230016.240912-5-helgaas@kernel.orgSigned-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent ec6a75ef
...@@ -517,6 +517,12 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) ...@@ -517,6 +517,12 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
return 0; return 0;
} }
static void pci_pm_default_resume(struct pci_dev *pci_dev)
{
pci_fixup_device(pci_fixup_resume, pci_dev);
pci_enable_wake(pci_dev, PCI_D0, false);
}
#endif #endif
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -645,12 +651,6 @@ static int pci_legacy_resume(struct device *dev) ...@@ -645,12 +651,6 @@ static int pci_legacy_resume(struct device *dev)
/* Auxiliary functions used by the new power management framework */ /* Auxiliary functions used by the new power management framework */
static void pci_pm_default_resume(struct pci_dev *pci_dev)
{
pci_fixup_device(pci_fixup_resume, pci_dev);
pci_enable_wake(pci_dev, PCI_D0, false);
}
static void pci_pm_default_suspend(struct pci_dev *pci_dev) static void pci_pm_default_suspend(struct pci_dev *pci_dev)
{ {
/* Disable non-bridge devices without PM support */ /* Disable non-bridge devices without PM support */
...@@ -992,7 +992,6 @@ static int pci_pm_resume(struct device *dev) ...@@ -992,7 +992,6 @@ static int pci_pm_resume(struct device *dev)
#ifdef CONFIG_HIBERNATE_CALLBACKS #ifdef CONFIG_HIBERNATE_CALLBACKS
/* /*
* pcibios_pm_ops - provide arch-specific hooks when a PCI device is doing * pcibios_pm_ops - provide arch-specific hooks when a PCI device is doing
* a hibernate transition * a hibernate transition
...@@ -1345,8 +1344,7 @@ static int pci_pm_runtime_resume(struct device *dev) ...@@ -1345,8 +1344,7 @@ static int pci_pm_runtime_resume(struct device *dev)
return 0; return 0;
pci_fixup_device(pci_fixup_resume_early, pci_dev); pci_fixup_device(pci_fixup_resume_early, pci_dev);
pci_enable_wake(pci_dev, PCI_D0, false); pci_pm_default_resume(pci_dev);
pci_fixup_device(pci_fixup_resume, pci_dev);
if (pm && pm->runtime_resume) if (pm && pm->runtime_resume)
rc = pm->runtime_resume(dev); rc = pm->runtime_resume(dev);
......
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