diff options
-rw-r--r-- | drivers/pci/bus.c | 56 | ||||
-rw-r--r-- | drivers/pci/pci.h | 1 |
2 files changed, 34 insertions, 23 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 1b6de1b565aa..52b54f053be0 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -91,6 +91,37 @@ int pci_bus_add_device(struct pci_dev *dev) | |||
91 | } | 91 | } |
92 | 92 | ||
93 | /** | 93 | /** |
94 | * pci_bus_add_child - add a child bus | ||
95 | * @bus: bus to add | ||
96 | * | ||
97 | * This adds sysfs entries for a single bus | ||
98 | */ | ||
99 | int pci_bus_add_child(struct pci_bus *bus) | ||
100 | { | ||
101 | int retval; | ||
102 | |||
103 | if (bus->bridge) | ||
104 | bus->dev.parent = bus->bridge; | ||
105 | |||
106 | retval = device_register(&bus->dev); | ||
107 | if (retval) | ||
108 | return retval; | ||
109 | |||
110 | bus->is_added = 1; | ||
111 | |||
112 | retval = device_create_file(&bus->dev, &dev_attr_cpuaffinity); | ||
113 | if (retval) | ||
114 | return retval; | ||
115 | |||
116 | retval = device_create_file(&bus->dev, &dev_attr_cpulistaffinity); | ||
117 | |||
118 | /* Create legacy_io and legacy_mem files for this bus */ | ||
119 | pci_create_legacy_files(bus); | ||
120 | |||
121 | return retval; | ||
122 | } | ||
123 | |||
124 | /** | ||
94 | * pci_bus_add_devices - insert newly discovered PCI devices | 125 | * pci_bus_add_devices - insert newly discovered PCI devices |
95 | * @bus: bus to check for new devices | 126 | * @bus: bus to check for new devices |
96 | * | 127 | * |
@@ -140,30 +171,9 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
140 | */ | 171 | */ |
141 | if (child->is_added) | 172 | if (child->is_added) |
142 | continue; | 173 | continue; |
143 | child->dev.parent = child->bridge; | 174 | retval = pci_bus_add_child(child); |
144 | retval = device_register(&child->dev); | ||
145 | if (retval) | 175 | if (retval) |
146 | dev_err(&dev->dev, "Error registering pci_bus," | 176 | dev_err(&dev->dev, "Error adding bus, continuing\n"); |
147 | " continuing...\n"); | ||
148 | else { | ||
149 | child->is_added = 1; | ||
150 | retval = device_create_file(&child->dev, | ||
151 | &dev_attr_cpuaffinity); | ||
152 | if (retval) | ||
153 | dev_err(&dev->dev, "Error creating cpuaffinity" | ||
154 | " file, continuing...\n"); | ||
155 | |||
156 | retval = device_create_file(&child->dev, | ||
157 | &dev_attr_cpulistaffinity); | ||
158 | if (retval) | ||
159 | dev_err(&dev->dev, | ||
160 | "Error creating cpulistaffinity" | ||
161 | " file, continuing...\n"); | ||
162 | |||
163 | /* Create legacy_io and legacy_mem files for this bus */ | ||
164 | pci_create_legacy_files(child_bus); | ||
165 | |||
166 | } | ||
167 | } | 177 | } |
168 | } | 178 | } |
169 | 179 | ||
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index c4f4a1e6ea28..d1e92d83aa06 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -173,6 +173,7 @@ extern int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
173 | struct resource *res, unsigned int reg); | 173 | struct resource *res, unsigned int reg); |
174 | extern int pci_resource_bar(struct pci_dev *dev, int resno, | 174 | extern int pci_resource_bar(struct pci_dev *dev, int resno, |
175 | enum pci_bar_type *type); | 175 | enum pci_bar_type *type); |
176 | extern int pci_bus_add_child(struct pci_bus *bus); | ||
176 | extern void pci_enable_ari(struct pci_dev *dev); | 177 | extern void pci_enable_ari(struct pci_dev *dev); |
177 | /** | 178 | /** |
178 | * pci_ari_enabled - query ARI forwarding status | 179 | * pci_ari_enabled - query ARI forwarding status |