[PATCH v2 2/2] PCI/pwrctrl: Only create pwrctrl device if the device node belongs to a PCI device
From: Manivannan Sadhasivam via B4 Relay
Date: Mon Feb 23 2026 - 09:48:02 EST
From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
The PCI host bridge node can have non-PCI child nodes as well, like OPP
tables, USB hub etc... So the pwrctrl core must ensure that the pwrctrl
device is only created for PCI device nodes by checking for the 'pci'
prefix in the compatible property.
Fixes: 4c4132489201 ("PCI/pwrctrl: Add APIs to create, destroy pwrctrl devices")
Reported-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/20260212-rb3gen2-upd-gl3590-v1-1-18fb04bb32b0@xxxxxxxxxxxxxxxx
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
---
drivers/pci/pwrctrl/core.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 8325858cc379..7754baed67f2 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -272,7 +272,8 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
* Check whether the pwrctrl device really needs to be created or not. The
* pwrctrl device will only be created if the node satisfies below requirements:
*
- * 1. Presence of compatible property to match against the pwrctrl driver (AND)
+ * 1. Presence of compatible property with "pci" prefix to match against the
+ * pwrctrl driver (AND)
* 2. At least one of the power supplies defined in the devicetree node of the
* device (OR) in the remote endpoint parent node to indicate pwrctrl
* requirement.
@@ -280,8 +281,14 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices);
static bool pci_pwrctrl_is_required(struct device_node *np)
{
struct device_node *endpoint;
+ const char *compat;
+ int ret;
+
+ ret = of_property_read_string(np, "compatible", &compat);
+ if (ret < 0)
+ return false;
- if (!of_property_present(np, "compatible"))
+ if (!strstarts(compat, "pci"))
return false;
if (of_pci_supply_present(np))
--
2.51.0