]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Power on bridges before scanning new devices
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 2 Jun 2016 08:17:13 +0000 (11:17 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 13 Jun 2016 19:57:58 +0000 (14:57 -0500)
commit0e677d9c6780566f2bd1b29b6786a9d5aa04d5c0
tree7171b4bff0089b092976e7b0672db144e018854b
parent406587bd61f8f8f40f6e7bf4b339bbcdc083f6fd
PCI: Power on bridges before scanning new devices

When a PCI device is removed through sysfs interface, the upstream bridge
(PCIe port) can be runtime suspended if it was the last device on that bus.
Now, if the bridge is in D3 we cannot find devices below the bridge
anymore.  For example following fails to find the removed device again:

  # echo 1 > /sys/bus/pci/devices/0000:00:01.0/0000:01:00.0/remove
  # echo 1 > /sys/bus/pci/devices/0000:00:01.0/rescan

Where 0000:00:01.0 is the bridge device.

In order to be able to rescan devices below the bridge add
pm_runtime_get_sync()/pm_runtime_put() calls to pci_scan_bridge().  This
should keep bridges powered on while their children devices are being
scanned.

Reported-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/probe.c