Skip to content

Commit f7b32a8

Browse files
committed
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.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ec6a75e commit f7b32a8

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎drivers/pci/pci-driver.c‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,12 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
517517
return 0;
518518
}
519519

520+
static void pci_pm_default_resume(struct pci_dev *pci_dev)
521+
{
522+
pci_fixup_device(pci_fixup_resume, pci_dev);
523+
pci_enable_wake(pci_dev, PCI_D0, false);
524+
}
525+
520526
#endif
521527

522528
#ifdef CONFIG_PM_SLEEP
@@ -645,12 +651,6 @@ static int pci_legacy_resume(struct device *dev)
645651

646652
/* Auxiliary functions used by the new power management framework */
647653

648-
static void pci_pm_default_resume(struct pci_dev *pci_dev)
649-
{
650-
pci_fixup_device(pci_fixup_resume, pci_dev);
651-
pci_enable_wake(pci_dev, PCI_D0, false);
652-
}
653-
654654
static void pci_pm_default_suspend(struct pci_dev *pci_dev)
655655
{
656656
/* Disable non-bridge devices without PM support */
@@ -992,7 +992,6 @@ static int pci_pm_resume(struct device *dev)
992992

993993
#ifdef CONFIG_HIBERNATE_CALLBACKS
994994

995-
996995
/*
997996
* pcibios_pm_ops - provide arch-specific hooks when a PCI device is doing
998997
* a hibernate transition
@@ -1345,8 +1344,7 @@ static int pci_pm_runtime_resume(struct device *dev)
13451344
return 0;
13461345

13471346
pci_fixup_device(pci_fixup_resume_early, pci_dev);
1348-
pci_enable_wake(pci_dev, PCI_D0, false);
1349-
pci_fixup_device(pci_fixup_resume, pci_dev);
1347+
pci_pm_default_resume(pci_dev);
13501348

13511349
if (pm && pm->runtime_resume)
13521350
rc = pm->runtime_resume(dev);

0 commit comments

Comments
 (0)