diff options
-rw-r--r-- | drivers/base/bus.c | 6 | ||||
-rw-r--r-- | drivers/pci/probe.c | 11 | ||||
-rw-r--r-- | include/linux/device.h | 1 |
3 files changed, 14 insertions, 4 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 8335a1079b0e..9c9027b2c44e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -941,6 +941,12 @@ struct kset *bus_get_kset(struct bus_type *bus) | |||
941 | } | 941 | } |
942 | EXPORT_SYMBOL_GPL(bus_get_kset); | 942 | EXPORT_SYMBOL_GPL(bus_get_kset); |
943 | 943 | ||
944 | struct klist *bus_get_device_klist(struct bus_type *bus) | ||
945 | { | ||
946 | return &bus->klist_devices; | ||
947 | } | ||
948 | EXPORT_SYMBOL_GPL(bus_get_device_klist); | ||
949 | |||
944 | int __init buses_init(void) | 950 | int __init buses_init(void) |
945 | { | 951 | { |
946 | bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); | 952 | bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index c5ca3134513a..5fd585293e79 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -1210,16 +1210,19 @@ static void __init pci_sort_breadthfirst_klist(void) | |||
1210 | struct klist_node *n; | 1210 | struct klist_node *n; |
1211 | struct device *dev; | 1211 | struct device *dev; |
1212 | struct pci_dev *pdev; | 1212 | struct pci_dev *pdev; |
1213 | struct klist *device_klist; | ||
1213 | 1214 | ||
1214 | spin_lock(&pci_bus_type.klist_devices.k_lock); | 1215 | device_klist = bus_get_device_klist(&pci_bus_type); |
1215 | list_for_each_safe(pos, tmp, &pci_bus_type.klist_devices.k_list) { | 1216 | |
1217 | spin_lock(&device_klist->k_lock); | ||
1218 | list_for_each_safe(pos, tmp, &device_klist->k_list) { | ||
1216 | n = container_of(pos, struct klist_node, n_node); | 1219 | n = container_of(pos, struct klist_node, n_node); |
1217 | dev = container_of(n, struct device, knode_bus); | 1220 | dev = container_of(n, struct device, knode_bus); |
1218 | pdev = to_pci_dev(dev); | 1221 | pdev = to_pci_dev(dev); |
1219 | pci_insertion_sort_klist(pdev, &sorted_devices); | 1222 | pci_insertion_sort_klist(pdev, &sorted_devices); |
1220 | } | 1223 | } |
1221 | list_splice(&sorted_devices, &pci_bus_type.klist_devices.k_list); | 1224 | list_splice(&sorted_devices, &device_klist->k_list); |
1222 | spin_unlock(&pci_bus_type.klist_devices.k_lock); | 1225 | spin_unlock(&device_klist->k_lock); |
1223 | } | 1226 | } |
1224 | 1227 | ||
1225 | static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list) | 1228 | static void __init pci_insertion_sort_devices(struct pci_dev *a, struct list_head *list) |
diff --git a/include/linux/device.h b/include/linux/device.h index 3cc13c32314a..62e695bd3c93 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -118,6 +118,7 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
118 | unbound */ | 118 | unbound */ |
119 | 119 | ||
120 | extern struct kset *bus_get_kset(struct bus_type *bus); | 120 | extern struct kset *bus_get_kset(struct bus_type *bus); |
121 | extern struct klist *bus_get_device_klist(struct bus_type *bus); | ||
121 | 122 | ||
122 | struct device_driver { | 123 | struct device_driver { |
123 | const char * name; | 124 | const char * name; |