diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-05 17:20:00 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-07-05 17:20:00 -0400 |
commit | db288c9c5f9db45610dab3940377625132b4af41 (patch) | |
tree | ef859024757b4b468eb33aa5d9f879aa28fdd754 /drivers/pci/pci-driver.c | |
parent | 448bd857d48e69b33ef323739dc6d8ca20d4cda7 (diff) |
PCI / PM: restore the original behavior of pci_set_power_state()
Commit cc2893b6 (PCI: Ensure we re-enable devices on resume)
addressed the problem with USB not being powered after resume on
recent Lenovo machines, but it did that in a suboptimal way.
Namely, it should have changed the relevant code paths only,
which are pci_pm_resume_noirq() and pci_pm_restore_noirq() supposed
to restore the device's power and standard configuration registers
after system resume from suspend or hibernation. Instead, however,
it modified pci_set_power_state() which is executed in several
other situations too. That resulted in some undesirable effects,
like attempting to change a device's power state in the same way
multiple times in a row (up to as many as 4 times in a row in the
snd_hda_intel driver).
Fix the bug addressed by commit cc2893b6 in an alternative way,
by forcibly powering up all devices in pci_pm_default_resume_early(),
which is called by pci_pm_resume_noirq() and pci_pm_restore_noirq()
to restore the device's power and standard configuration registers,
and modifying pci_pm_runtime_resume() to avoid the forcible power-up
if not necessary. Then, revert the changes made by commit cc2893b6
to make the confusion introduced by it go away.
Acked-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ca2e4c79a588..1dd1d9dfa173 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -459,16 +459,17 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) | |||
459 | return 0; | 459 | return 0; |
460 | } | 460 | } |
461 | 461 | ||
462 | #endif | ||
463 | |||
464 | #ifdef CONFIG_PM_SLEEP | ||
465 | |||
462 | static void pci_pm_default_resume_early(struct pci_dev *pci_dev) | 466 | static void pci_pm_default_resume_early(struct pci_dev *pci_dev) |
463 | { | 467 | { |
464 | pci_restore_standard_config(pci_dev); | 468 | pci_power_up(pci_dev); |
469 | pci_restore_state(pci_dev); | ||
465 | pci_fixup_device(pci_fixup_resume_early, pci_dev); | 470 | pci_fixup_device(pci_fixup_resume_early, pci_dev); |
466 | } | 471 | } |
467 | 472 | ||
468 | #endif | ||
469 | |||
470 | #ifdef CONFIG_PM_SLEEP | ||
471 | |||
472 | /* | 473 | /* |
473 | * Default "suspend" method for devices that have no driver provided suspend, | 474 | * Default "suspend" method for devices that have no driver provided suspend, |
474 | * or not even a driver at all (second part). | 475 | * or not even a driver at all (second part). |
@@ -1054,7 +1055,8 @@ static int pci_pm_runtime_resume(struct device *dev) | |||
1054 | if (!pm || !pm->runtime_resume) | 1055 | if (!pm || !pm->runtime_resume) |
1055 | return -ENOSYS; | 1056 | return -ENOSYS; |
1056 | 1057 | ||
1057 | pci_pm_default_resume_early(pci_dev); | 1058 | pci_restore_standard_config(pci_dev); |
1059 | pci_fixup_device(pci_fixup_resume_early, pci_dev); | ||
1058 | __pci_enable_wake(pci_dev, PCI_D0, true, false); | 1060 | __pci_enable_wake(pci_dev, PCI_D0, true, false); |
1059 | pci_fixup_device(pci_fixup_resume, pci_dev); | 1061 | pci_fixup_device(pci_fixup_resume, pci_dev); |
1060 | 1062 | ||