Commit 5ff580c10ec06fd296bd23d4570c1a95194094a0
1 parent
c71c68a04b
Exists in
master
and in
7 other branches
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>
Showing 4 changed files with 1 additions and 49 deletions Side-by-side Diff
drivers/pci/bus.c
drivers/pci/probe.c
... | ... | @@ -20,9 +20,7 @@ |
20 | 20 | LIST_HEAD(pci_root_buses); |
21 | 21 | EXPORT_SYMBOL(pci_root_buses); |
22 | 22 | |
23 | -LIST_HEAD(pci_devices); | |
24 | 23 | |
25 | - | |
26 | 24 | static int find_anything(struct device *dev, void *data) |
27 | 25 | { |
28 | 26 | return 1; |
... | ... | @@ -860,7 +858,6 @@ |
860 | 858 | if (!dev) |
861 | 859 | return NULL; |
862 | 860 | |
863 | - INIT_LIST_HEAD(&dev->global_list); | |
864 | 861 | INIT_LIST_HEAD(&dev->bus_list); |
865 | 862 | |
866 | 863 | pci_msi_init_pci_dev(dev); |
... | ... | @@ -957,7 +954,6 @@ |
957 | 954 | * Add the device to our list of discovered devices |
958 | 955 | * and the bus list for fixup functions, etc. |
959 | 956 | */ |
960 | - INIT_LIST_HEAD(&dev->global_list); | |
961 | 957 | down_write(&pci_bus_sem); |
962 | 958 | list_add_tail(&dev->bus_list, &bus->devices); |
963 | 959 | up_write(&pci_bus_sem); |
... | ... | @@ -1186,7 +1182,7 @@ |
1186 | 1182 | list_move_tail(&a->dev.knode_bus.n_node, list); |
1187 | 1183 | } |
1188 | 1184 | |
1189 | -static void __init pci_sort_breadthfirst_klist(void) | |
1185 | +void __init pci_sort_breadthfirst(void) | |
1190 | 1186 | { |
1191 | 1187 | LIST_HEAD(sorted_devices); |
1192 | 1188 | struct list_head *pos, *tmp; |
... | ... | @@ -1206,37 +1202,5 @@ |
1206 | 1202 | } |
1207 | 1203 | list_splice(&sorted_devices, &device_klist->k_list); |
1208 | 1204 | spin_unlock(&device_klist->k_lock); |
1209 | -} | |
1210 | - | |
1211 | -static 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 | - | |
1224 | -static 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 | - | |
1237 | -void __init pci_sort_breadthfirst(void) | |
1238 | -{ | |
1239 | - pci_sort_breadthfirst_devices(); | |
1240 | - pci_sort_breadthfirst_klist(); | |
1241 | 1205 | } |
drivers/pci/remove.c
... | ... | @@ -23,10 +23,6 @@ |
23 | 23 | pci_remove_sysfs_dev_files(dev); |
24 | 24 | device_unregister(&dev->dev); |
25 | 25 | dev->is_added = 0; |
26 | - down_write(&pci_bus_sem); | |
27 | - list_del(&dev->global_list); | |
28 | - dev->global_list.next = dev->global_list.prev = NULL; | |
29 | - up_write(&pci_bus_sem); | |
30 | 26 | } |
31 | 27 | } |
32 | 28 |
include/linux/pci.h
... | ... | @@ -132,7 +132,6 @@ |
132 | 132 | * The pci_dev structure is used to describe PCI devices. |
133 | 133 | */ |
134 | 134 | struct pci_dev { |
135 | - struct list_head global_list; /* node in list of all PCI devices */ | |
136 | 135 | struct list_head bus_list; /* node in per-bus list */ |
137 | 136 | struct pci_bus *bus; /* bus this device is on */ |
138 | 137 | struct pci_bus *subordinate; /* bus this device bridges to */ |
... | ... | @@ -206,7 +205,6 @@ |
206 | 205 | |
207 | 206 | extern struct pci_dev *alloc_pci_dev(void); |
208 | 207 | |
209 | -#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) | |
210 | 208 | #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) |
211 | 209 | #define to_pci_dev(n) container_of(n, struct pci_dev, dev) |
212 | 210 | #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) |
... | ... | @@ -450,7 +448,6 @@ |
450 | 448 | /* Do NOT directly access these two variables, unless you are arch specific pci |
451 | 449 | * code, or pci core code. */ |
452 | 450 | extern struct list_head pci_root_buses; /* list of all known PCI buses */ |
453 | -extern struct list_head pci_devices; /* list of all devices */ | |
454 | 451 | /* Some device drivers need know if pci is initiated */ |
455 | 452 | extern int no_pci_devices(void); |
456 | 453 |