All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/pwrctrl: Only destroy devices created by pwrctrl core
@ 2026-10-08  8:05 Shawn Lin
  2026-10-08  8:28 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shawn Lin @ 2026-10-08  8:05 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Bartosz Golaszewski, Bjorn Helgaas
  Cc: linux-pci, Shawn Lin

pci_pwrctrl_create_device() only creates platform devices for OF nodes
that pci_pwrctrl_is_required() accepts, but pci_pwrctrl_destroy_device()
unregisters the platform device of every available child node without
that check.

Nodes under a PCI host controller that are not pwrctrl devices may have
been populated by another mechanism.  Destroying them here would tear
down devices owned by other code.

Mirror the check done at creation time so that only devices created by
the pwrctrl core are removed.

Fixes: 4c4132489201 ("PCI/pwrctrl: Add APIs to create, destroy pwrctrl devices")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/pwrctrl/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 10d817a..c14df11 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -388,6 +388,9 @@ static void pci_pwrctrl_destroy_device(struct device_node *np)
 	for_each_available_child_of_node_scoped(np, child)
 		pci_pwrctrl_destroy_device(child);
 
+	if (!pci_pwrctrl_is_required(np))
+		return;
+
 	pdev = of_find_device_by_node(np);
 	if (!pdev)
 		return;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-09  0:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08  8:05 [PATCH] PCI/pwrctrl: Only destroy devices created by pwrctrl core Shawn Lin
2026-10-08  8:28 ` sashiko-bot
2026-10-08  9:38 ` Bartosz Golaszewski
2026-10-08 23:32 ` Bjorn Helgaas
2026-10-09  0:24   ` Shawn Lin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.