===================================================================
@@ -263,22 +263,17 @@ static long local_pci_probe(void *_ddi)
/* The parent bridge must be in active state when probing */
if (parent)
pm_runtime_get_sync(parent);
- /* Unbound PCI devices are always set to disabled and suspended.
- * During probe, the device is set to enabled and active and the
- * usage count is incremented. If the driver supports runtime PM,
- * it should call pm_runtime_put_noidle() in its probe routine and
+ /*
+ * During probe, the device is set to active and the usage count is
+ * incremented. If the driver supports runtime PM, it should call
+ * pm_runtime_put_noidle() in its probe routine and
* pm_runtime_get_noresume() in its remove routine.
*/
- pm_runtime_get_noresume(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
-
+ pm_runtime_get_sync(dev);
rc = ddi->drv->probe(ddi->dev, ddi->id);
- if (rc) {
- pm_runtime_disable(dev);
- pm_runtime_set_suspended(dev);
- pm_runtime_put_noidle(dev);
- }
+ if (rc)
+ pm_runtime_put_sync(dev);
+
if (parent)
pm_runtime_put(parent);
return rc;
@@ -369,9 +364,7 @@ static int pci_device_remove(struct devi
}
/* Undo the runtime PM settings in local_pci_probe() */
- pm_runtime_disable(dev);
- pm_runtime_set_suspended(dev);
- pm_runtime_put_noidle(dev);
+ pm_runtime_put_sync(dev);
/*
* If the device is still on, set the power state as "unknown",
@@ -1003,7 +996,7 @@ static int pci_pm_runtime_suspend(struct
int error;
if (!pm || !pm->runtime_suspend)
- return -ENOSYS;
+ return 0;
pci_dev->no_d3cold = false;
error = pm->runtime_suspend(dev);
@@ -1038,7 +1031,7 @@ static int pci_pm_runtime_resume(struct
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
if (!pm || !pm->runtime_resume)
- return -ENOSYS;
+ return 0;
pci_restore_standard_config(pci_dev);
pci_fixup_device(pci_fixup_resume_early, pci_dev);
@@ -1056,10 +1049,7 @@ static int pci_pm_runtime_idle(struct de
{
const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
- if (!pm)
- return -ENOSYS;
-
- if (pm->runtime_idle) {
+ if (pm && pm->runtime_idle) {
int ret = pm->runtime_idle(dev);
if (ret)
return ret;
===================================================================
@@ -1868,6 +1868,8 @@ void pci_pm_init(struct pci_dev *dev)
u16 pmc;
pm_runtime_forbid(&dev->dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(&dev->dev);
device_enable_async_suspend(&dev->dev);
dev->wakeup_prepared = false;