Merge branch 'pci/hotplug'

- Use for_each_child_of_node_scoped() to simplify iteration over OF
  children (Krzysztof Kozlowski)

- Set LED_HW_PLUGGABLE for NPEM hotplug-capable ports so LED core doesn't
  complain when setting brightness fails because the endpoint is gone
  (Richard Cheng)

* pci/hotplug:
  PCI/NPEM: Set LED_HW_PLUGGABLE for hotplug-capable ports
  PCI: rpaphp: Simplify with scoped for each OF child loop
  PCI: pnv_php: Simplify with scoped for each OF child loop
This commit is contained in:
Bjorn Helgaas 2026-04-13 12:50:03 -05:00
commit c9aad55980
3 changed files with 9 additions and 16 deletions

View File

@ -215,24 +215,19 @@ static void pnv_php_reverse_nodes(struct device_node *parent)
static int pnv_php_populate_changeset(struct of_changeset *ocs,
struct device_node *dn)
{
struct device_node *child;
int ret = 0;
int ret;
for_each_child_of_node(dn, child) {
for_each_child_of_node_scoped(dn, child) {
ret = of_changeset_attach_node(ocs, child);
if (ret) {
of_node_put(child);
break;
}
if (ret)
return ret;
ret = pnv_php_populate_changeset(ocs, child);
if (ret) {
of_node_put(child);
break;
}
if (ret)
return ret;
}
return ret;
return 0;
}
static void *pnv_php_add_one_pdn(struct device_node *dn, void *data)

View File

@ -82,7 +82,6 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
int rpaphp_register_slot(struct slot *slot)
{
struct hotplug_slot *php_slot = &slot->hotplug_slot;
struct device_node *child;
u32 my_index;
int retval;
int slotno = -1;
@ -97,11 +96,10 @@ int rpaphp_register_slot(struct slot *slot)
return -EAGAIN;
}
for_each_child_of_node(slot->dn, child) {
for_each_child_of_node_scoped(slot->dn, child) {
retval = of_property_read_u32(child, "ibm,my-drc-index", &my_index);
if (my_index == slot->index) {
slotno = PCI_SLOT(PCI_DN(child)->devfn);
of_node_put(child);
break;
}
}

View File

@ -504,7 +504,7 @@ static int pci_npem_set_led_classdev(struct npem *npem, struct npem_led *nled)
led->brightness_get = brightness_get;
led->max_brightness = 1;
led->default_trigger = "none";
led->flags = 0;
led->flags = LED_HW_PLUGGABLE;
ret = led_classdev_register(&npem->dev->dev, led);
if (ret)