Commit ea8c88f13d9fb1d6b39a05bfa07ae076ca1c6803

Authored by Huang Ying
Committed by Bjorn Helgaas
1 parent 4f9c1397e2

PCI/PM: Keep parent bridge active when probing device

This patch fixes the following bug:

http://marc.info/?l=linux-pci&m=134329923124234&w=2

The root cause of the bug is as follow.

If a device is not bound with the corresponding driver, the device
runtime PM will be disabled and the device will be put into suspended
state.  So that, the bridge/PCIe port connected to it may be put into
suspended and low power state.  When do probing for the device later,
because the bridge/PCIe port connected to it is in low power state,
the IO access to device may fail.

To solve the issue, the bridge/PCIe port connected to the device is
put into active state before probing.

Reported-by: Bjorn Mork <bjorn@mork.no>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rjw@sisk.pl>

Showing 1 changed file with 6 additions and 0 deletions Side-by-side Diff

drivers/pci/pci-driver.c
... ... @@ -280,8 +280,12 @@
280 280 {
281 281 struct drv_dev_and_id *ddi = _ddi;
282 282 struct device *dev = &ddi->dev->dev;
  283 + struct device *parent = dev->parent;
283 284 int rc;
284 285  
  286 + /* The parent bridge must be in active state when probing */
  287 + if (parent)
  288 + pm_runtime_get_sync(parent);
285 289 /* Unbound PCI devices are always set to disabled and suspended.
286 290 * During probe, the device is set to enabled and active and the
287 291 * usage count is incremented. If the driver supports runtime PM,
... ... @@ -298,6 +302,8 @@
298 302 pm_runtime_set_suspended(dev);
299 303 pm_runtime_put_noidle(dev);
300 304 }
  305 + if (parent)
  306 + pm_runtime_put(parent);
301 307 return rc;
302 308 }
303 309