diff mbox

PCI: use pm_runtime_get_sync during system suspend

Message ID Pine.LNX.4.44L0.1006211701350.1687-100000@iolanthe.rowland.org (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Alan Stern June 21, 2010, 9:03 p.m. UTC
None
diff mbox

Patch

Index: usb-2.6/drivers/pci/pci-driver.c
===================================================================
--- usb-2.6.orig/drivers/pci/pci-driver.c
+++ usb-2.6/drivers/pci/pci-driver.c
@@ -623,10 +623,13 @@  static int pci_pm_prepare(struct device 
 	 * system from the sleep state, we'll have to prevent it from signaling
 	 * wake-up.
 	 */
-	pm_runtime_resume(dev);
+	pm_runtime_get_sync(dev);
 
-	if (drv && drv->pm && drv->pm->prepare)
+	if (drv && drv->pm && drv->pm->prepare) {
 		error = drv->pm->prepare(dev);
+		if (error)
+			pm_runtime_put_sync(dev);
+	}
 
 	return error;
 }
@@ -637,6 +640,7 @@  static void pci_pm_complete(struct devic
 
 	if (drv && drv->pm && drv->pm->complete)
 		drv->pm->complete(dev);
+	pm_runtime_put_sync(dev);
 }
 
 #else /* !CONFIG_PM_SLEEP */