diff options
author | Tiejun Chen <tiejun.chen@windriver.com> | 2011-06-01 23:02:50 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-07-22 11:25:38 -0400 |
commit | b1a98b695b4efe10067d0e1cb5b66146a4e517bf (patch) | |
tree | 102d98bae1ffdd17a2090bcfee6b42c2c4bf39dd /drivers/pci | |
parent | 0918472ceeffad234df5589e45b646a94476f835 (diff) |
PCI: enumerate the PCI device only removed out PCI hieratchy of OS when re-scanning PCI
When hot-plugging a root bridge, we always prevent assigning a bus number
that already exists. This makes sure we don't step over an existing bus.
But sometimes we only remove PCI device in PCI hieratchy of OS, i,e.
echo 1 > /sys/bus/pci/devices/.../remove
but actually don't hotplug this device out the platform, so in this case
we still should re-scan this bus to enumerate this device when re-scanning
PCI again.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/probe.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index bafb3c3d4a89..f03ed96533d5 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -724,12 +724,14 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, | |||
724 | pci_write_config_word(dev, PCI_STATUS, 0xffff); | 724 | pci_write_config_word(dev, PCI_STATUS, 0xffff); |
725 | 725 | ||
726 | /* Prevent assigning a bus number that already exists. | 726 | /* Prevent assigning a bus number that already exists. |
727 | * This can happen when a bridge is hot-plugged */ | 727 | * This can happen when a bridge is hot-plugged, so in |
728 | if (pci_find_bus(pci_domain_nr(bus), max+1)) | 728 | * this case we only re-scan this bus. */ |
729 | goto out; | 729 | child = pci_find_bus(pci_domain_nr(bus), max+1); |
730 | child = pci_add_new_bus(bus, dev, ++max); | 730 | if (!child) { |
731 | if (!child) | 731 | child = pci_add_new_bus(bus, dev, ++max); |
732 | goto out; | 732 | if (!child) |
733 | goto out; | ||
734 | } | ||
733 | buses = (buses & 0xff000000) | 735 | buses = (buses & 0xff000000) |
734 | | ((unsigned int)(child->primary) << 0) | 736 | | ((unsigned int)(child->primary) << 0) |
735 | | ((unsigned int)(child->secondary) << 8) | 737 | | ((unsigned int)(child->secondary) << 8) |