Skip to content

Commit 9c7364d

Browse files
author
Fox Snowpatch
committed
1 parent 960c1fd commit 9c7364d

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

arch/powerpc/include/asm/pci.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ extern void pci_adjust_legacy_attr(struct pci_bus *bus,
8686
enum pci_mmap_state mmap_type);
8787
#define HAVE_PCI_LEGACY 1
8888

89-
extern void pcibios_claim_one_bus(struct pci_bus *b);
89+
extern int pcibios_claim_one_bus(struct pci_bus *b);
9090

91-
extern void pcibios_finish_adding_to_bus(struct pci_bus *bus);
91+
extern int pcibios_finish_adding_to_bus(struct pci_bus *bus);
9292

9393
extern void pcibios_resource_survey(void);
9494

arch/powerpc/kernel/pci-common.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,10 +1446,11 @@ void __init pcibios_resource_survey(void)
14461446
* rest of the code later, for now, keep it as-is as our main
14471447
* resource allocation function doesn't deal with sub-trees yet.
14481448
*/
1449-
void pcibios_claim_one_bus(struct pci_bus *bus)
1449+
int pcibios_claim_one_bus(struct pci_bus *bus)
14501450
{
14511451
struct pci_dev *dev;
14521452
struct pci_bus *child_bus;
1453+
int ret = 0;
14531454

14541455
list_for_each_entry(dev, &bus->devices, bus_list) {
14551456
struct resource *r;
@@ -1462,15 +1463,20 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
14621463
pr_debug("PCI: Claiming %s: Resource %d: %pR\n",
14631464
pci_name(dev), i, r);
14641465

1465-
if (pci_claim_resource(dev, i) == 0)
1466+
ret = pci_claim_resource(dev, i);
1467+
if (ret == 0)
14661468
continue;
1469+
else
1470+
return ret;
14671471

14681472
pci_claim_bridge_resource(dev, i);
14691473
}
14701474
}
14711475

14721476
list_for_each_entry(child_bus, &bus->children, node)
1473-
pcibios_claim_one_bus(child_bus);
1477+
ret = pcibios_claim_one_bus(child_bus);
1478+
1479+
return ret;
14741480
}
14751481
EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
14761482

@@ -1481,14 +1487,19 @@ EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
14811487
* added to a bus, this include calling it for a PHB that is just
14821488
* being added
14831489
*/
1484-
void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1490+
int pcibios_finish_adding_to_bus(struct pci_bus *bus)
14851491
{
1492+
int ret = 0;
1493+
14861494
pr_debug("PCI: Finishing adding to hotplug bus %04x:%02x\n",
14871495
pci_domain_nr(bus), bus->number);
14881496

14891497
/* Allocate bus and devices resources */
14901498
pcibios_allocate_bus_resources(bus);
1491-
pcibios_claim_one_bus(bus);
1499+
ret = pcibios_claim_one_bus(bus);
1500+
if (ret)
1501+
return ret;
1502+
14921503
if (!pci_has_flag(PCI_PROBE_ONLY)) {
14931504
if (bus->self)
14941505
pci_assign_unassigned_bridge_resources(bus->self);
@@ -1498,6 +1509,8 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
14981509

14991510
/* Add new devices to global lists. Register in proc, sysfs. */
15001511
pci_bus_add_devices(bus);
1512+
1513+
return ret;
15011514
}
15021515
EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
15031516

arch/powerpc/kernel/pci-hotplug.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ void pci_hp_add_devices(struct pci_bus *bus)
140140
struct pci_dev *dev;
141141
struct pci_controller *phb;
142142
struct device_node *dn = pci_bus_to_OF_node(bus);
143+
int ret = 0;
143144

144145
if (!dn)
145146
return;
@@ -176,6 +177,8 @@ void pci_hp_add_devices(struct pci_bus *bus)
176177
for_each_pci_bridge(dev, bus)
177178
max = pci_scan_bridge(bus, dev, max, 1);
178179
}
179-
pcibios_finish_adding_to_bus(bus);
180+
ret = pcibios_finish_adding_to_bus(bus);
181+
if (ret)
182+
pr_err("%s: unable to add hotplug pci device!\n");
180183
}
181184
EXPORT_SYMBOL_GPL(pci_hp_add_devices);

arch/powerpc/platforms/pseries/pci_dlpar.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)
5858
pseries_eeh_init_edev_recursive(PCI_DN(dn));
5959

6060
pcibios_scan_phb(phb);
61-
pcibios_finish_adding_to_bus(phb->bus);
61+
if (pcibios_finish_adding_to_bus(phb->bus))
62+
return NULL;
6263

6364
return phb;
6465
}

drivers/pci/hotplug/rpadlpar_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn)
240240
}
241241

242242
phb = init_phb_dynamic(dn);
243-
if (!phb)
243+
if (!phb) {
244+
pr_err("%s: unable to add hotplug slot %s\n", drc_name);
244245
return -EIO;
246+
}
245247

246248
if (rpaphp_add_slot(dn)) {
247249
printk(KERN_ERR "%s: unable to add hotplug slot %s\n",
@@ -311,6 +313,9 @@ int dlpar_add_slot(char *drc_name)
311313
}
312314
of_node_put(dn);
313315

316+
if (rc)
317+
goto exit;
318+
314319
printk(KERN_INFO "%s: slot %s added\n", DLPAR_MODULE_NAME, drc_name);
315320
exit:
316321
mutex_unlock(&rpadlpar_mutex);

0 commit comments

Comments
 (0)