aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index d3aa9df1acd4..3eefe2cec72d 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -103,13 +103,13 @@ static struct slot *find_slot(struct device_node *dn)
103 struct list_head *tmp, *n; 103 struct list_head *tmp, *n;
104 struct slot *slot; 104 struct slot *slot;
105 105
106 list_for_each_safe(tmp, n, &rpaphp_slot_head) { 106 list_for_each_safe(tmp, n, &rpaphp_slot_head) {
107 slot = list_entry(tmp, struct slot, rpaphp_slot_list); 107 slot = list_entry(tmp, struct slot, rpaphp_slot_list);
108 if (slot->dn == dn) 108 if (slot->dn == dn)
109 return slot; 109 return slot;
110 } 110 }
111 111
112 return NULL; 112 return NULL;
113} 113}
114 114
115static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, 115static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
@@ -126,9 +126,9 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
126 return NULL; 126 return NULL;
127} 127}
128 128
129static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) 129static void dlpar_pci_add_bus(struct device_node *dn)
130{ 130{
131 struct pci_dn *pdn = dn->data; 131 struct pci_dn *pdn = PCI_DN(dn);
132 struct pci_controller *phb = pdn->phb; 132 struct pci_controller *phb = pdn->phb;
133 struct pci_dev *dev = NULL; 133 struct pci_dev *dev = NULL;
134 134
@@ -139,7 +139,7 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
139 if (!dev) { 139 if (!dev) {
140 printk(KERN_ERR "%s: failed to create pci dev for %s\n", 140 printk(KERN_ERR "%s: failed to create pci dev for %s\n",
141 __FUNCTION__, dn->full_name); 141 __FUNCTION__, dn->full_name);
142 return NULL; 142 return;
143 } 143 }
144 144
145 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 145 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
@@ -156,35 +156,35 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
156 156
157 /* Add new devices to global lists. Register in proc, sysfs. */ 157 /* Add new devices to global lists. Register in proc, sysfs. */
158 pci_bus_add_devices(phb->bus); 158 pci_bus_add_devices(phb->bus);
159
160 /* Confirm new bridge dev was created */
161 dev = dlpar_find_new_dev(phb->bus, dn);
162 if (dev) {
163 if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
164 printk(KERN_ERR "%s: unexpected header type %d\n",
165 __FUNCTION__, dev->hdr_type);
166 return NULL;
167 }
168 }
169
170 return dev;
171} 159}
172 160
173static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) 161static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
174{ 162{
175 struct pci_dev *dev; 163 struct pci_dev *dev;
164 struct pci_controller *phb;
176 165
177 if (pcibios_find_pci_bus(dn)) 166 if (pcibios_find_pci_bus(dn))
178 return -EINVAL; 167 return -EINVAL;
179 168
180 /* Add pci bus */ 169 /* Add pci bus */
181 dev = dlpar_pci_add_bus(dn); 170 dlpar_pci_add_bus(dn);
171
172 /* Confirm new bridge dev was created */
173 phb = PCI_DN(dn)->phb;
174 dev = dlpar_find_new_dev(phb->bus, dn);
175
182 if (!dev) { 176 if (!dev) {
183 printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__, 177 printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__,
184 drc_name); 178 drc_name);
185 return -EIO; 179 return -EIO;
186 } 180 }
187 181
182 if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
183 printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n",
184 __FUNCTION__, dev->hdr_type, drc_name);
185 return -EIO;
186 }
187
188 /* Add hotplug slot */ 188 /* Add hotplug slot */
189 if (rpaphp_add_slot(dn)) { 189 if (rpaphp_add_slot(dn)) {
190 printk(KERN_ERR "%s: unable to add hotplug slot %s\n", 190 printk(KERN_ERR "%s: unable to add hotplug slot %s\n",