[PATCH v6 04/27] bus: simple-pm-bus: Remove child devices when the bus is unbound

Herve Codina
2026-03-25T14:37:32Z

During its probe, the simple-pm-bus driver (simple-pm-bus compatible
variant) populates its child devices but it doesn't touch them during
its removal.

This leads to bus child devices present and bound to drivers whereas the
bus itself is unbound.

Be consistent and remove child devices when the bus itself is unbound.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
drivers/bus/simple-pm-bus.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c
index 3f00d953fb9a..9ebd588ea24f 100644
--- a/drivers/bus/simple-pm-bus.c
+++ b/drivers/bus/simple-pm-bus.c
@@ -83,6 +83,9 @@ static void simple_pm_bus_remove(struct platform_device *pdev)

dev_dbg(&pdev->dev, "%s\n", __func__);

+ if (pdev->dev.of_node)
+ of_platform_depopulate(&pdev->dev);
+
pm_runtime_disable(&pdev->dev);
}

--
2.53.0