Commit 5ff580c1 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c71c68a0
...@@ -85,10 +85,6 @@ int pci_bus_add_device(struct pci_dev *dev) ...@@ -85,10 +85,6 @@ int pci_bus_add_device(struct pci_dev *dev)
return retval; return retval;
dev->is_added = 1; dev->is_added = 1;
down_write(&pci_bus_sem);
list_add_tail(&dev->global_list, &pci_devices);
up_write(&pci_bus_sem);
pci_proc_attach_device(dev); pci_proc_attach_device(dev);
pci_create_sysfs_dev_files(dev); pci_create_sysfs_dev_files(dev);
return 0; return 0;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
LIST_HEAD(pci_root_buses); LIST_HEAD(pci_root_buses);
EXPORT_SYMBOL(pci_root_buses); EXPORT_SYMBOL(pci_root_buses);
LIST_HEAD(pci_devices);
static int find_anything(struct device *dev, void *data) static int find_anything(struct device *dev, void *data)
{ {
...@@ -860,7 +858,6 @@ struct pci_dev *alloc_pci_dev(void) ...@@ -860,7 +858,6 @@ struct pci_dev *alloc_pci_dev(void)
if (!dev) if (!dev)
return NULL; return NULL;
INIT_LIST_HEAD(&dev->global_list);
INIT_LIST_HEAD(&dev->bus_list); INIT_LIST_HEAD(&dev->bus_list);
pci_msi_init_pci_dev(dev); pci_msi_init_pci_dev(dev);
...@@ -957,7 +954,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) ...@@ -957,7 +954,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
* Add the device to our list of discovered devices * Add the device to our list of discovered devices
* and the bus list for fixup functions, etc. * and the bus list for fixup functions, etc.
*/ */
INIT_LIST_HEAD(&dev->global_list);
down_write(&pci_bus_sem); down_write(&pci_bus_sem);
list_add_tail(&dev->bus_list, &bus->devices); list_add_tail(&dev->bus_list, &bus->devices);
up_write(&pci_bus_sem); up_write(&pci_bus_sem);
...@@ -1186,7 +1182,7 @@ static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head ...@@ -1186,7 +1182,7 @@ static void __init pci_insertion_sort_klist(struct pci_dev *a, struct list_head
list_move_tail(&a->dev.knode_bus.n_node, list); list_move_tail(&a->dev.knode_bus.n_node, list);
} }
static void __init pci_sort_breadthfirst_klist(void) void __init pci_sort_breadthfirst(void)
{ {
LIST_HEAD(sorted_devices); LIST_HEAD(sorted_devices);
struct list_head *pos, *tmp; struct list_head *pos, *tmp;
...@@ -1207,36 +1203,3 @@ static void __init pci_sort_breadthfirst_klist(void) ...@@ -1207,36 +1203,3 @@ static void __init pci_sort_breadthfirst_klist(void)
list_splice(&sorted_devices, &device_klist->k_list); list_splice(&sorted_devices, &device_klist->k_list);
spin_unlock(&device_klist->k_lock); spin_unlock(&device_klist->k_lock);
} }
static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list)
{
struct pci_dev *b;
list_for_each_entry(b, list, global_list) {
if (pci_sort_bf_cmp(a, b) <= 0) {
list_move_tail(&a->global_list, &b->global_list);
return;
}
}
list_move_tail(&a->global_list, list);
}
static void __init pci_sort_breadthfirst_devices(void)
{
LIST_HEAD(sorted_devices);
struct pci_dev *dev, *tmp;
down_write(&pci_bus_sem);
list_for_each_entry_safe(dev, tmp, &pci_devices, global_list) {
pci_insertion_sort_devices(dev, &sorted_devices);
}
list_splice(&sorted_devices, &pci_devices);
up_write(&pci_bus_sem);
}
void __init pci_sort_breadthfirst(void)
{
pci_sort_breadthfirst_devices();
pci_sort_breadthfirst_klist();
}
...@@ -23,10 +23,6 @@ static void pci_stop_dev(struct pci_dev *dev) ...@@ -23,10 +23,6 @@ static void pci_stop_dev(struct pci_dev *dev)
pci_remove_sysfs_dev_files(dev); pci_remove_sysfs_dev_files(dev);
device_unregister(&dev->dev); device_unregister(&dev->dev);
dev->is_added = 0; dev->is_added = 0;
down_write(&pci_bus_sem);
list_del(&dev->global_list);
dev->global_list.next = dev->global_list.prev = NULL;
up_write(&pci_bus_sem);
} }
} }
......
...@@ -132,7 +132,6 @@ struct pci_cap_saved_state { ...@@ -132,7 +132,6 @@ struct pci_cap_saved_state {
* The pci_dev structure is used to describe PCI devices. * The pci_dev structure is used to describe PCI devices.
*/ */
struct pci_dev { struct pci_dev {
struct list_head global_list; /* node in list of all PCI devices */
struct list_head bus_list; /* node in per-bus list */ struct list_head bus_list; /* node in per-bus list */
struct pci_bus *bus; /* bus this device is on */ struct pci_bus *bus; /* bus this device is on */
struct pci_bus *subordinate; /* bus this device bridges to */ struct pci_bus *subordinate; /* bus this device bridges to */
...@@ -206,7 +205,6 @@ struct pci_dev { ...@@ -206,7 +205,6 @@ struct pci_dev {
extern struct pci_dev *alloc_pci_dev(void); extern struct pci_dev *alloc_pci_dev(void);
#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
#define to_pci_dev(n) container_of(n, struct pci_dev, dev) #define to_pci_dev(n) container_of(n, struct pci_dev, dev)
#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
...@@ -450,7 +448,6 @@ extern struct bus_type pci_bus_type; ...@@ -450,7 +448,6 @@ extern struct bus_type pci_bus_type;
/* Do NOT directly access these two variables, unless you are arch specific pci /* Do NOT directly access these two variables, unless you are arch specific pci
* code, or pci core code. */ * code, or pci core code. */
extern struct list_head pci_root_buses; /* list of all known PCI buses */ extern struct list_head pci_root_buses; /* list of all known PCI buses */
extern struct list_head pci_devices; /* list of all devices */
/* Some device drivers need know if pci is initiated */ /* Some device drivers need know if pci is initiated */
extern int no_pci_devices(void); extern int no_pci_devices(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment