summaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpadlpar_core.c
diff options
context:
space:
mode:
authorJohn Rose <johnrose@austin.ibm.com>2005-07-25 10:16:53 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 14:57:23 -0700
commit0945cd5f908a09ad99bf42d7ded16f26f24f317d (patch)
tree83ca671af8a9e2560d8bed3c63fbffa59d96af58 /drivers/pci/hotplug/rpadlpar_core.c
parent9c209c919df95f83aa042b3352c43841ad15a02b (diff)
downloadlinux-0945cd5f908a09ad99bf42d7ded16f26f24f317d.tar.bz2
[PATCH] PCI Hotplug: rpaphp: Remove rpaphp_find_pci
The rpaphp module currently uses a fragile method to find a pci device by its device node. This function is unnecessary, so this patch scraps it. Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/rpadlpar_core.c')
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 7f868edaa72d..2ee7eb513e6c 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -165,6 +165,20 @@ static int pci_add_secondary_bus(struct device_node *dn,
return 0;
}
+static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
+ struct device_node *dev_dn)
+{
+ struct pci_dev *tmp = NULL;
+ struct device_node *child_dn;
+
+ list_for_each_entry(tmp, &parent->devices, bus_list) {
+ child_dn = pci_device_to_OF_node(tmp);
+ if (child_dn == dev_dn)
+ return tmp;
+ }
+ return NULL;
+}
+
static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
{
struct pci_controller *hose = dn->phb;
@@ -180,21 +194,18 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
pci_bus_add_devices(hose->bus);
/* Confirm new bridge dev was created */
- dev = rpaphp_find_pci_dev(dn);
- if (!dev) {
- printk(KERN_ERR "%s: failed to add pci device\n", __FUNCTION__);
- return NULL;
- }
+ dev = dlpar_find_new_dev(hose->bus, dn);
+ if (dev) {
+ if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
+ printk(KERN_ERR "%s: unexpected header type %d\n",
+ __FUNCTION__, dev->hdr_type);
+ return NULL;
+ }
- if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
- printk(KERN_ERR "%s: unexpected header type %d\n",
- __FUNCTION__, dev->hdr_type);
- return NULL;
+ if (pci_add_secondary_bus(dn, dev))
+ return NULL;
}
- if (pci_add_secondary_bus(dn, dev))
- return NULL;
-
return dev;
}