[PATCH] PCI: use pm_runtime_get_sync during system suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch (as1402) fixes a bug in the PCI core.  When a device is
about to be suspended, the core does a runtime resume because the
device settings may need to be reconfigured.  But calling
pm_runtime_resume() is not the right way to do this, because it does
nothing to prevent the device from autosuspending immediately
afterward.  The core needs to use pm_runtime_get_sync() and
pm_runtime_put_sync() instead.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
CC: Rafael J. Wysocki <rjw@xxxxxxx>

---

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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux