PCI: brcmstb: Fix potential premature regulator disabling

[ Upstream commit b7de1b60ecab2f7b6f05d8116e93228a0bbb8563 ]

The platform supports enabling and disabling regulators only on
ports below the Root Complex.

Thus, we need to verify this both when adding and removing the bus,
otherwise regulators may be disabled prematurely when a bus further
down the topology is removed.

Fixes: 9e6be018b2 ("PCI: brcmstb: Enable child bus device regulators from DT")
Signed-off-by: Jim Quinlan <james.quinlan@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20250214173944.47506-6-james.quinlan@broadcom.com
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jim Quinlan
2025-02-14 12:39:33 -05:00
committed by Greg Kroah-Hartman
parent 99a0efba9f
commit d68c455954

View File

@@ -1141,7 +1141,7 @@ static void brcm_pcie_remove_bus(struct pci_bus *bus)
struct subdev_regulators *sr = pcie->sr; struct subdev_regulators *sr = pcie->sr;
struct device *dev = &bus->dev; struct device *dev = &bus->dev;
if (!sr) if (!sr || !bus->parent || !pci_is_root_bus(bus->parent))
return; return;
if (regulator_bulk_disable(sr->num_supplies, sr->supplies)) if (regulator_bulk_disable(sr->num_supplies, sr->supplies))