aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c20
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c8
2 files changed, 17 insertions, 11 deletions
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 4ada15111af0..ad1017da8656 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -134,7 +134,8 @@ static void rpadlpar_claim_one_bus(struct pci_bus *b)
134static int pci_add_secondary_bus(struct device_node *dn, 134static int pci_add_secondary_bus(struct device_node *dn,
135 struct pci_dev *bridge_dev) 135 struct pci_dev *bridge_dev)
136{ 136{
137 struct pci_controller *hose = dn->phb; 137 struct pci_dn *pdn = dn->data;
138 struct pci_controller *hose = pdn->phb;
138 struct pci_bus *child; 139 struct pci_bus *child;
139 u8 sec_busno; 140 u8 sec_busno;
140 141
@@ -159,7 +160,7 @@ static int pci_add_secondary_bus(struct device_node *dn,
159 if (hose->last_busno < child->number) 160 if (hose->last_busno < child->number)
160 hose->last_busno = child->number; 161 hose->last_busno = child->number;
161 162
162 dn->bussubno = child->number; 163 pdn->bussubno = child->number;
163 164
164 /* ioremap() for child bus, which may or may not succeed */ 165 /* ioremap() for child bus, which may or may not succeed */
165 remap_bus_range(child); 166 remap_bus_range(child);
@@ -183,11 +184,12 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
183 184
184static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) 185static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
185{ 186{
186 struct pci_controller *hose = dn->phb; 187 struct pci_dn *pdn = dn->data;
188 struct pci_controller *hose = pdn->phb;
187 struct pci_dev *dev = NULL; 189 struct pci_dev *dev = NULL;
188 190
189 /* Scan phb bus for EADS device, adding new one to bus->devices */ 191 /* Scan phb bus for EADS device, adding new one to bus->devices */
190 if (!pci_scan_single_device(hose->bus, dn->devfn)) { 192 if (!pci_scan_single_device(hose->bus, pdn->devfn)) {
191 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__); 193 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__);
192 return NULL; 194 return NULL;
193 } 195 }
@@ -269,6 +271,7 @@ static int dlpar_remove_root_bus(struct pci_controller *phb)
269static int dlpar_remove_phb(char *drc_name, struct device_node *dn) 271static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
270{ 272{
271 struct slot *slot; 273 struct slot *slot;
274 struct pci_dn *pdn;
272 int rc = 0; 275 int rc = 0;
273 276
274 if (!rpaphp_find_pci_bus(dn)) 277 if (!rpaphp_find_pci_bus(dn))
@@ -285,12 +288,13 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
285 } 288 }
286 } 289 }
287 290
288 BUG_ON(!dn->phb); 291 pdn = dn->data;
289 rc = dlpar_remove_root_bus(dn->phb); 292 BUG_ON(!pdn || !pdn->phb);
293 rc = dlpar_remove_root_bus(pdn->phb);
290 if (rc < 0) 294 if (rc < 0)
291 return rc; 295 return rc;
292 296
293 dn->phb = NULL; 297 pdn->phb = NULL;
294 298
295 return 0; 299 return 0;
296} 300}
@@ -299,7 +303,7 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn)
299{ 303{
300 struct pci_controller *phb; 304 struct pci_controller *phb;
301 305
302 if (dn->phb) { 306 if (PCI_DN(dn)->phb) {
303 /* PHB already exists */ 307 /* PHB already exists */
304 return -EINVAL; 308 return -EINVAL;
305 } 309 }
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 17a0279ebcb9..49e4d10a6488 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -51,10 +51,12 @@ static struct pci_bus *find_bus_among_children(struct pci_bus *bus,
51 51
52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) 52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn)
53{ 53{
54 if (!dn->phb || !dn->phb->bus) 54 struct pci_dn *pdn = dn->data;
55
56 if (!pdn || !pdn->phb || !pdn->phb->bus)
55 return NULL; 57 return NULL;
56 58
57 return find_bus_among_children(dn->phb->bus, dn); 59 return find_bus_among_children(pdn->phb->bus, dn);
58} 60}
59EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); 61EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
60 62
@@ -229,7 +231,7 @@ rpaphp_pci_config_slot(struct pci_bus *bus)
229 if (!dn || !dn->child) 231 if (!dn || !dn->child)
230 return NULL; 232 return NULL;
231 233
232 slotno = PCI_SLOT(dn->child->devfn); 234 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
233 235
234 /* pci_scan_slot should find all children */ 236 /* pci_scan_slot should find all children */
235 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 237 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));