diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-01 22:41:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:33 -0500 |
commit | b249072ee6897fe4f8d461c7bb4b926223263c28 (patch) | |
tree | a6dde5703458677302516145c47f308e52cda189 /drivers/pci/probe.c | |
parent | 0fed80f7a63abd7168907267af69ee31f6bcf301 (diff) |
driver core: add way to get to bus device klist
This allows an easier way to get to the device klist associated with a
struct bus_type (you have three to choose from...) This will make it
easier to move these fields to be dynamic in a future patch.
The only user of this is the PCI core which horribly abuses this
interface to rearrange the order of the pci devices. This should be
done using the existing bus device walking functions, but that's left
for future patches.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 11 |
1 files changed, 7 insertions, 4 deletions
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) |