aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2009-09-09 17:49:59 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-14 16:41:46 -0400
commit4b77b0a2ba27d64f58f16d8d4d48d8319dda36ff (patch)
tree957f38dc1065e2880197e7ca5ffe1592515010b3 /drivers/pci/pci-driver.c
parent999cce4a52d5abdda5d2cec6bac241899bc19e4c (diff)
PCI: Clear saved_state after the state has been restored
Some PCI devices fail if their standard configuration registers are restored twice in a row. Prevent this from happening by making pci_restore_state() clear the saved_state flag of the device right after the device's standard configuration registers have been populated with the previously saved values. Simplify PCI PM callbacks by removing the direct clearing of state_saved from them, as it shouldn't be necessary any more (except in pci_pm_thaw(), where it has to be cleared, so that the values saved during the "freeze" phase of hibernation are not used later by mistake). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index dbfc93cb5d01..ffc15e97d11c 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -445,8 +445,6 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
445 struct pci_dev * pci_dev = to_pci_dev(dev); 445 struct pci_dev * pci_dev = to_pci_dev(dev);
446 struct pci_driver * drv = pci_dev->driver; 446 struct pci_driver * drv = pci_dev->driver;
447 447
448 pci_dev->state_saved = false;
449
450 if (drv && drv->suspend) { 448 if (drv && drv->suspend) {
451 pci_power_t prev = pci_dev->current_state; 449 pci_power_t prev = pci_dev->current_state;
452 int error; 450 int error;
@@ -542,7 +540,6 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
542static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) 540static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
543{ 541{
544 pci_restore_standard_config(pci_dev); 542 pci_restore_standard_config(pci_dev);
545 pci_dev->state_saved = false;
546 pci_fixup_device(pci_fixup_resume_early, pci_dev); 543 pci_fixup_device(pci_fixup_resume_early, pci_dev);
547} 544}
548 545
@@ -608,8 +605,6 @@ static int pci_pm_suspend(struct device *dev)
608 if (pci_has_legacy_pm_support(pci_dev)) 605 if (pci_has_legacy_pm_support(pci_dev))
609 return pci_legacy_suspend(dev, PMSG_SUSPEND); 606 return pci_legacy_suspend(dev, PMSG_SUSPEND);
610 607
611 pci_dev->state_saved = false;
612
613 if (!pm) { 608 if (!pm) {
614 pci_pm_default_suspend(pci_dev); 609 pci_pm_default_suspend(pci_dev);
615 goto Fixup; 610 goto Fixup;
@@ -744,8 +739,6 @@ static int pci_pm_freeze(struct device *dev)
744 if (pci_has_legacy_pm_support(pci_dev)) 739 if (pci_has_legacy_pm_support(pci_dev))
745 return pci_legacy_suspend(dev, PMSG_FREEZE); 740 return pci_legacy_suspend(dev, PMSG_FREEZE);
746 741
747 pci_dev->state_saved = false;
748
749 if (!pm) { 742 if (!pm) {
750 pci_pm_default_suspend(pci_dev); 743 pci_pm_default_suspend(pci_dev);
751 return 0; 744 return 0;
@@ -821,6 +814,8 @@ static int pci_pm_thaw(struct device *dev)
821 pci_pm_reenable_device(pci_dev); 814 pci_pm_reenable_device(pci_dev);
822 } 815 }
823 816
817 pci_dev->state_saved = false;
818
824 return error; 819 return error;
825} 820}
826 821
@@ -832,8 +827,6 @@ static int pci_pm_poweroff(struct device *dev)
832 if (pci_has_legacy_pm_support(pci_dev)) 827 if (pci_has_legacy_pm_support(pci_dev))
833 return pci_legacy_suspend(dev, PMSG_HIBERNATE); 828 return pci_legacy_suspend(dev, PMSG_HIBERNATE);
834 829
835 pci_dev->state_saved = false;
836
837 if (!pm) { 830 if (!pm) {
838 pci_pm_default_suspend(pci_dev); 831 pci_pm_default_suspend(pci_dev);
839 goto Fixup; 832 goto Fixup;