From c4cac4a15c6e7a6f9517a2ddc9dc8d7d0d1aa11c Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Tue, 17 Mar 2026 14:33:25 +0100 Subject: [PATCH 1/3] PCI: pnv_php: Simplify with scoped for each OF child loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Ilpo Järvinen Link: https://patch.msgid.link/20260317133322.266102-7-krzysztof.kozlowski@oss.qualcomm.com --- drivers/pci/hotplug/pnv_php.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 5c020831e318..ff92a5c301b8 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c @@ -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) From 79253d6fe1cc80938160be2625d270fe5a4252ee Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Tue, 17 Mar 2026 14:33:26 +0100 Subject: [PATCH 2/3] PCI: rpaphp: Simplify with scoped for each OF child loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use scoped for-each loop when iterating over device nodes to make code a bit simpler. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Ilpo Järvinen Link: https://patch.msgid.link/20260317133322.266102-8-krzysztof.kozlowski@oss.qualcomm.com --- drivers/pci/hotplug/rpaphp_slot.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index 33ca19200c1b..67362e5b9971 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c @@ -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; } } From 16d021c878dca22532c984668c9e8cf4722d6a49 Mon Sep 17 00:00:00 2001 From: Richard Cheng Date: Thu, 2 Apr 2026 17:38:50 +0800 Subject: [PATCH 3/3] PCI/NPEM: Set LED_HW_PLUGGABLE for hotplug-capable ports NPEM registers LED classdevs on PCI endpoint that may be behind hotplug-capable ports. During hot-removal, led_classdev_unregister() calls led_set_brightness(LED_OFF) which leads to a PCI config read to a disconnected device, which fails and returns -ENODEV (topology details in msgid.link below): leds 0003:01:00.0:enclosure:ok: Setting an LED's brightness failed (-19) The LED core already suppresses this for devices with LED_HW_PLUGGABLE set, but NPEM never sets it. Add the flag since NPEM LEDs are on hot-pluggable hardware by nature. Fixes: 4e893545ef87 ("PCI/NPEM: Add Native PCIe Enclosure Management support") Signed-off-by: Richard Cheng Signed-off-by: Bjorn Helgaas Reviewed-by: Lukas Wunner Acked-by: Kai-Heng Feng Link: https://patch.msgid.link/20260402093850.23075-1-icheng@nvidia.com --- drivers/pci/npem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/npem.c b/drivers/pci/npem.c index ffeeedf6e311..c51879fcd438 100644 --- a/drivers/pci/npem.c +++ b/drivers/pci/npem.c @@ -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)