aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/bus.c')
-rw-r--r--drivers/pci/bus.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index d708358326e5..e1c079aa0e82 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -84,6 +84,7 @@ int pci_bus_add_device(struct pci_dev *dev)
84 if (retval) 84 if (retval)
85 return retval; 85 return retval;
86 86
87 dev->is_added = 1;
87 down_write(&pci_bus_sem); 88 down_write(&pci_bus_sem);
88 list_add_tail(&dev->global_list, &pci_devices); 89 list_add_tail(&dev->global_list, &pci_devices);
89 up_write(&pci_bus_sem); 90 up_write(&pci_bus_sem);
@@ -112,11 +113,8 @@ void pci_bus_add_devices(struct pci_bus *bus)
112 int retval; 113 int retval;
113 114
114 list_for_each_entry(dev, &bus->devices, bus_list) { 115 list_for_each_entry(dev, &bus->devices, bus_list) {
115 /* 116 /* Skip already-added devices */
116 * Skip already-present devices (which are on the 117 if (dev->is_added)
117 * global device list.)
118 */
119 if (!list_empty(&dev->global_list))
120 continue; 118 continue;
121 retval = pci_bus_add_device(dev); 119 retval = pci_bus_add_device(dev);
122 if (retval) 120 if (retval)
@@ -124,8 +122,7 @@ void pci_bus_add_devices(struct pci_bus *bus)
124 } 122 }
125 123
126 list_for_each_entry(dev, &bus->devices, bus_list) { 124 list_for_each_entry(dev, &bus->devices, bus_list) {
127 125 BUG_ON(!dev->is_added);
128 BUG_ON(list_empty(&dev->global_list));
129 126
130 /* 127 /*
131 * If there is an unattached subordinate bus, attach 128 * If there is an unattached subordinate bus, attach