aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-02-14 17:56:56 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-21 00:47:02 -0400
commit5ff580c10ec06fd296bd23d4570c1a95194094a0 (patch)
treefc00b4a107824519ae452c264674e5b8c2768d8e /drivers/pci/probe.c
parentc71c68a04ba7672b9373ef04173114c211bb9f88 (diff)
PCI: remove global list of PCI devices
This patch finally removes the global list of PCI devices. We are relying entirely on the list held in the driver core now, and do not need a separate "shadow" list as no one uses it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c39
1 files changed, 1 insertions, 38 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7217f4283ce..504f19b2af4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -20,8 +20,6 @@
20LIST_HEAD(pci_root_buses); 20LIST_HEAD(pci_root_buses);
21EXPORT_SYMBOL(pci_root_buses); 21EXPORT_SYMBOL(pci_root_buses);
22 22
23LIST_HEAD(pci_devices);
24
25 23
26static int find_anything(struct device *dev, void *data) 24static int find_anything(struct device *dev, void *data)
27{ 25{
@@ -860,7 +858,6 @@ struct pci_dev *alloc_pci_dev(void)
860 if (!dev) 858 if (!dev)
861 return NULL; 859 return NULL;
862 860
863 INIT_LIST_HEAD(&dev->global_list);
864 INIT_LIST_HEAD(&dev->bus_list); 861 INIT_LIST_HEAD(&dev->bus_list);
865 862
866 pci_msi_init_pci_dev(dev); 863 pci_msi_init_pci_dev(dev);
@@ -957,7 +954,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
957 * Add the device to our list of discovered devices 954 * Add the device to our list of discovered devices
958 * and the bus list for fixup functions, etc. 955 * and the bus list for fixup functions, etc.
959 */ 956 */
960 INIT_LIST_HEAD(&dev->global_list);
961 down_write(&pci_bus_sem); 957 down_write(&pci_bus_sem);
962 list_add_tail(&dev->bus_list, &bus->devices); 958 list_add_tail(&dev->bus_list, &bus->devices);
963 up_write(&pci_bus_sem); 959 up_write(&pci_bus_sem);
@@ -1186,7 +1182,7 @@ static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head
1186 list_move_tail(&a->dev.knode_bus.n_node, list); 1182 list_move_tail(&a->dev.knode_bus.n_node, list);
1187} 1183}
1188 1184
1189static void __init pci_sort_breadthfirst_klist(void) 1185void __init pci_sort_breadthfirst(void)
1190{ 1186{
1191 LIST_HEAD(sorted_devices); 1187 LIST_HEAD(sorted_devices);
1192 struct list_head *pos, *tmp; 1188 struct list_head *pos, *tmp;
@@ -1207,36 +1203,3 @@ static void __init pci_sort_breadthfirst_klist(void)
1207 list_splice(&sorted_devices, &device_klist->k_list); 1203 list_splice(&sorted_devices, &device_klist->k_list);
1208 spin_unlock(&device_klist->k_lock); 1204 spin_unlock(&device_klist->k_lock);
1209} 1205}
1210
1211static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list)
1212{
1213 struct pci_dev *b;
1214
1215 list_for_each_entry(b, list, global_list) {
1216 if (pci_sort_bf_cmp(a, b) <= 0) {
1217 list_move_tail(&a->global_list, &b->global_list);
1218 return;
1219 }
1220 }
1221 list_move_tail(&a->global_list, list);
1222}
1223
1224static void __init pci_sort_breadthfirst_devices(void)
1225{
1226 LIST_HEAD(sorted_devices);
1227 struct pci_dev *dev, *tmp;
1228
1229 down_write(&pci_bus_sem);
1230 list_for_each_entry_safe(dev, tmp, &pci_devices, global_list) {
1231 pci_insertion_sort_devices(dev, &sorted_devices);
1232 }
1233 list_splice(&sorted_devices, &pci_devices);
1234 up_write(&pci_bus_sem);
1235}
1236
1237void __init pci_sort_breadthfirst(void)
1238{
1239 pci_sort_breadthfirst_devices();
1240 pci_sort_breadthfirst_klist();
1241}
1242