]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/pci-driver.c
drm/i915: Skip SDVO/HDMI init when the chipset tells us it's not present.
[linux-2.6-omap-h63xx.git] / drivers / pci / pci-driver.c
index 9de07b75b993b0e81346cd516c2021849d50901e..ab1d615425a8858248b61efe4a5ed22fcfa764db 100644 (file)
@@ -370,6 +370,7 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
        }
 
        pci_save_state(pci_dev);
+       pci_dev->state_saved = true;
        /*
         * This is for compatibility with existing code with legacy PM support.
         */
@@ -419,6 +420,7 @@ static int pci_legacy_resume(struct device *dev)
 static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
 {
        pci_restore_standard_config(pci_dev);
+       pci_dev->state_saved = false;
        pci_fixup_device(pci_fixup_resume_early, pci_dev);
 }
 
@@ -555,6 +557,13 @@ static int pci_pm_resume(struct device *dev)
        struct device_driver *drv = dev->driver;
        int error = 0;
 
+       /*
+        * This is necessary for the suspend error path in which resume is
+        * called without restoring the standard config registers of the device.
+        */
+       if (pci_dev->state_saved)
+               pci_restore_standard_config(pci_dev);
+
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
@@ -660,7 +669,10 @@ static int pci_pm_poweroff(struct device *dev)
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_HIBERNATE);
 
-       if (drv && drv->pm && drv->pm->poweroff) {
+       if (!drv || !drv->pm)
+               return 0;
+
+       if (drv->pm->poweroff) {
                error = drv->pm->poweroff(dev);
                suspend_report_result(drv->pm->poweroff, error);
        }
@@ -710,6 +722,13 @@ static int pci_pm_restore(struct device *dev)
        struct device_driver *drv = dev->driver;
        int error = 0;
 
+       /*
+        * This is necessary for the hibernation error path in which restore is
+        * called without restoring the standard config registers of the device.
+        */
+       if (pci_dev->state_saved)
+               pci_restore_standard_config(pci_dev);
+
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);