aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-31 11:32:31 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-05 16:30:01 -0500
commit9d45cf9e36bf9bcf16df6e1cbf049807c8402823 (patch)
tree2118a16701418af10d215d2174df7ee0a5cbe6bd /drivers/pci/pci-driver.c
parenta146649bc19d5eba4f5bfac6720c5f252d517a71 (diff)
parent0cd5c3c80a0ebd68c08312fa7d8c13149cc61c4c (diff)
Merge branch 'x86/urgent' into x86/apic
Conflicts: arch/x86/mach-default/setup.c Semantic merge: arch/x86/kernel/irqinit_32.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 9de07b75b993..ab1d615425a8 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -370,6 +370,7 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
370 } 370 }
371 371
372 pci_save_state(pci_dev); 372 pci_save_state(pci_dev);
373 pci_dev->state_saved = true;
373 /* 374 /*
374 * This is for compatibility with existing code with legacy PM support. 375 * This is for compatibility with existing code with legacy PM support.
375 */ 376 */
@@ -419,6 +420,7 @@ static int pci_legacy_resume(struct device *dev)
419static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev) 420static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
420{ 421{
421 pci_restore_standard_config(pci_dev); 422 pci_restore_standard_config(pci_dev);
423 pci_dev->state_saved = false;
422 pci_fixup_device(pci_fixup_resume_early, pci_dev); 424 pci_fixup_device(pci_fixup_resume_early, pci_dev);
423} 425}
424 426
@@ -555,6 +557,13 @@ static int pci_pm_resume(struct device *dev)
555 struct device_driver *drv = dev->driver; 557 struct device_driver *drv = dev->driver;
556 int error = 0; 558 int error = 0;
557 559
560 /*
561 * This is necessary for the suspend error path in which resume is
562 * called without restoring the standard config registers of the device.
563 */
564 if (pci_dev->state_saved)
565 pci_restore_standard_config(pci_dev);
566
558 if (pci_has_legacy_pm_support(pci_dev)) 567 if (pci_has_legacy_pm_support(pci_dev))
559 return pci_legacy_resume(dev); 568 return pci_legacy_resume(dev);
560 569
@@ -660,7 +669,10 @@ static int pci_pm_poweroff(struct device *dev)
660 if (pci_has_legacy_pm_support(pci_dev)) 669 if (pci_has_legacy_pm_support(pci_dev))
661 return pci_legacy_suspend(dev, PMSG_HIBERNATE); 670 return pci_legacy_suspend(dev, PMSG_HIBERNATE);
662 671
663 if (drv && drv->pm && drv->pm->poweroff) { 672 if (!drv || !drv->pm)
673 return 0;
674
675 if (drv->pm->poweroff) {
664 error = drv->pm->poweroff(dev); 676 error = drv->pm->poweroff(dev);
665 suspend_report_result(drv->pm->poweroff, error); 677 suspend_report_result(drv->pm->poweroff, error);
666 } 678 }
@@ -710,6 +722,13 @@ static int pci_pm_restore(struct device *dev)
710 struct device_driver *drv = dev->driver; 722 struct device_driver *drv = dev->driver;
711 int error = 0; 723 int error = 0;
712 724
725 /*
726 * This is necessary for the hibernation error path in which restore is
727 * called without restoring the standard config registers of the device.
728 */
729 if (pci_dev->state_saved)
730 pci_restore_standard_config(pci_dev);
731
713 if (pci_has_legacy_pm_support(pci_dev)) 732 if (pci_has_legacy_pm_support(pci_dev))
714 return pci_legacy_resume(dev); 733 return pci_legacy_resume(dev);
715 734