aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpaphp_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_pci.c')
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 4b35097b3d9f..396b54b0c847 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -62,28 +62,6 @@ struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn)
62} 62}
63EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); 63EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
64 64
65int rpaphp_claim_resource(struct pci_dev *dev, int resource)
66{
67 struct resource *res = &dev->resource[resource];
68 struct resource *root = pci_find_parent_resource(dev, res);
69 char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
70 int err = -EINVAL;
71
72 if (root != NULL) {
73 err = request_resource(root, res);
74 }
75
76 if (err) {
77 err("PCI: %s region %d of %s %s [%lx:%lx]\n",
78 root ? "Address space collision on" :
79 "No parent found for",
80 resource, dtype, pci_name(dev), res->start, res->end);
81 }
82 return err;
83}
84
85EXPORT_SYMBOL_GPL(rpaphp_claim_resource);
86
87static int rpaphp_get_sensor_state(struct slot *slot, int *state) 65static int rpaphp_get_sensor_state(struct slot *slot, int *state)
88{ 66{
89 int rc; 67 int rc;
@@ -177,7 +155,7 @@ void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
177 155
178 if (r->parent || !r->start || !r->flags) 156 if (r->parent || !r->start || !r->flags)
179 continue; 157 continue;
180 rpaphp_claim_resource(dev, i); 158 pci_claim_resource(dev, i);
181 } 159 }
182 } 160 }
183 } 161 }
@@ -287,18 +265,6 @@ rpaphp_pci_config_slot(struct pci_bus *bus)
287 return dev; 265 return dev;
288} 266}
289 267
290void rpaphp_eeh_init_nodes(struct device_node *dn)
291{
292 struct device_node *sib;
293
294 for (sib = dn->child; sib; sib = sib->sibling)
295 rpaphp_eeh_init_nodes(sib);
296 eeh_add_device_early(dn);
297 return;
298
299}
300EXPORT_SYMBOL_GPL(rpaphp_eeh_init_nodes);
301
302static void print_slot_pci_funcs(struct pci_bus *bus) 268static void print_slot_pci_funcs(struct pci_bus *bus)
303{ 269{
304 struct device_node *dn; 270 struct device_node *dn;
@@ -324,7 +290,7 @@ int rpaphp_config_pci_adapter(struct pci_bus *bus)
324 if (!dn) 290 if (!dn)
325 goto exit; 291 goto exit;
326 292
327 rpaphp_eeh_init_nodes(dn); 293 eeh_add_device_tree_early(dn);
328 dev = rpaphp_pci_config_slot(bus); 294 dev = rpaphp_pci_config_slot(bus);
329 if (!dev) { 295 if (!dev) {
330 err("%s: can't find any devices.\n", __FUNCTION__); 296 err("%s: can't find any devices.\n", __FUNCTION__);
@@ -370,13 +336,14 @@ EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter);
370 336
371static int setup_pci_hotplug_slot_info(struct slot *slot) 337static int setup_pci_hotplug_slot_info(struct slot *slot)
372{ 338{
339 struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info;
340
373 dbg("%s Initilize the PCI slot's hotplug->info structure ...\n", 341 dbg("%s Initilize the PCI slot's hotplug->info structure ...\n",
374 __FUNCTION__); 342 __FUNCTION__);
375 rpaphp_get_power_status(slot, &slot->hotplug_slot->info->power_status); 343 rpaphp_get_power_status(slot, &hotplug_slot_info->power_status);
376 rpaphp_get_pci_adapter_status(slot, 1, 344 rpaphp_get_pci_adapter_status(slot, 1,
377 &slot->hotplug_slot->info-> 345 &hotplug_slot_info->adapter_status);
378 adapter_status); 346 if (hotplug_slot_info->adapter_status == NOT_VALID) {
379 if (slot->hotplug_slot->info->adapter_status == NOT_VALID) {
380 err("%s: NOT_VALID: skip dn->full_name=%s\n", 347 err("%s: NOT_VALID: skip dn->full_name=%s\n",
381 __FUNCTION__, slot->dn->full_name); 348 __FUNCTION__, slot->dn->full_name);
382 return -EINVAL; 349 return -EINVAL;