powerpc/pci: Delay populating pdn
[cascardo/linux.git] / arch / powerpc / kernel / pci_dn.c
index afeda26..bfe60a1 100644 (file)
@@ -212,8 +212,7 @@ struct pci_dn *add_dev_pci_data(struct pci_dev *pdev)
 
 #ifdef CONFIG_EEH
                /* Create the EEH device for the VF */
-               eeh_dev_init(pdn, pci_bus_to_host(pdev->bus));
-               edev = pdn_to_eeh_dev(pdn);
+               edev = eeh_dev_init(pdn);
                BUG_ON(!edev);
                edev->physfn = pdev;
 #endif /* CONFIG_EEH */
@@ -295,8 +294,11 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
        const __be32 *regs;
        struct device_node *parent;
        struct pci_dn *pdn;
+#ifdef CONFIG_EEH
+       struct eeh_dev *edev;
+#endif
 
-       pdn = zalloc_maybe_bootmem(sizeof(*pdn), GFP_KERNEL);
+       pdn = kzalloc(sizeof(*pdn), GFP_KERNEL);
        if (pdn == NULL)
                return NULL;
        dn->data = pdn;
@@ -325,6 +327,15 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,
        /* Extended config space */
        pdn->pci_ext_config_space = (type && of_read_number(type, 1) == 1);
 
+       /* Create EEH device */
+#ifdef CONFIG_EEH
+       edev = eeh_dev_init(pdn);
+       if (!edev) {
+               kfree(pdn);
+               return NULL;
+       }
+#endif
+
        /* Attach to parent node */
        INIT_LIST_HEAD(&pdn->child_list);
        INIT_LIST_HEAD(&pdn->list);
@@ -510,15 +521,19 @@ void pci_devs_phb_init_dynamic(struct pci_controller *phb)
  * pci device found underneath.  This routine runs once,
  * early in the boot sequence.
  */
-void __init pci_devs_phb_init(void)
+static int __init pci_devs_phb_init(void)
 {
        struct pci_controller *phb, *tmp;
 
        /* This must be done first so the device nodes have valid pci info! */
        list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
                pci_devs_phb_init_dynamic(phb);
+
+       return 0;
 }
 
+core_initcall(pci_devs_phb_init);
+
 static void pci_dev_pdn_setup(struct pci_dev *pdev)
 {
        struct pci_dn *pdn;