]> err.no Git - linux-2.6/blobdiff - drivers/pci/pci-driver.c
PCI: reset pci device state to unknown state for resume
[linux-2.6] / drivers / pci / pci-driver.c
index b1c0c707d96ccc6e713042b1d67167609199c723..194f1d21d3d784d3ce73301acf42ff5c38240e32 100644 (file)
@@ -264,6 +264,13 @@ static int pci_device_remove(struct device * dev)
                pci_dev->driver = NULL;
        }
 
+       /*
+        * If the device is still on, set the power state as "unknown",
+        * since it might change by the next time we load the driver.
+        */
+       if (pci_dev->current_state == PCI_D0)
+               pci_dev->current_state = PCI_UNKNOWN;
+
        /*
         * We would love to complain here if pci_dev->is_enabled is set, that
         * the driver should have called pci_disable_device(), but the
@@ -288,6 +295,12 @@ static int pci_device_suspend(struct device * dev, pm_message_t state)
                suspend_report_result(drv->suspend, i);
        } else {
                pci_save_state(pci_dev);
+               /*
+                * mark its power state as "unknown", since we don't know if
+                * e.g. the BIOS will change its device state when we suspend.
+                */
+               if (pci_dev->current_state == PCI_D0)
+                       pci_dev->current_state = PCI_UNKNOWN;
        }
        return i;
 }