PCI: do not enable bridges more than once
authorAlex Chiang <achiang@hp.com>
Fri, 20 Mar 2009 20:56:20 +0000 (14:56 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 20 Mar 2009 21:57:36 +0000 (14:57 -0700)
In preparation for PCI core hotplug, we need to ensure that we do
not attempt to re-enable bridges that have already been enabled.

Reported-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/bus.c

index 118c777..68f91a2 100644 (file)
@@ -184,8 +184,10 @@ void pci_enable_bridges(struct pci_bus *bus)
 
        list_for_each_entry(dev, &bus->devices, bus_list) {
                if (dev->subordinate) {
-                       retval = pci_enable_device(dev);
-                       pci_set_master(dev);
+                       if (atomic_read(&dev->enable_cnt) == 0) {
+                               retval = pci_enable_device(dev);
+                               pci_set_master(dev);
+                       }
                        pci_enable_bridges(dev->subordinate);
                }
        }