From bdbdc4b398254597c9b6ac279f336750996bc0a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Draszik?= Date: Fri, 9 Jan 2026 08:38:41 +0000 Subject: [PATCH] regulator: core: remove dead code in regulator_resolve_supply() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since commit 98e48cd9283d ("regulator: core: resolve supply for boot-on/always-on regulators") we require that a regulator's supply has been resolved before enabling the regulator. Furthermore, regulator_get() also fails if the supply hasn't been resolved yet (preventing consumers from enabling a regulator without its supply known). In combination this means that regulator_resolve_supply() now always runs before the regulator has been enabled via set_machine_constraints(). The code here was meant to run after enabling the regulator in case the supply hadn't been resolved at that time and can therefore never execute anymore since that commit. Remove it. No functional change intended. Signed-off-by: André Draszik Link: https://patch.msgid.link/20260109-regulators-defer-v2-5-1a25dc968e60@linaro.org Signed-off-by: Mark Brown --- drivers/regulator/core.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 08bdb1e4175e6..fd8da369c0529 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2282,28 +2282,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) /* rdev->supply was created in set_supply() */ link_and_create_debugfs(rdev->supply, r, &rdev->dev); - /* - * In set_machine_constraints() we may have turned this regulator on - * but we couldn't propagate to the supply if it hadn't been resolved - * yet. Do it now. - */ - if (rdev->use_count) { - ret = regulator_enable(rdev->supply); - if (ret < 0) { - struct regulator *supply; - - regulator_lock_two(rdev, rdev->supply->rdev, &ww_ctx); - - supply = rdev->supply; - rdev->supply = NULL; - - regulator_unlock_two(rdev, supply->rdev, &ww_ctx); - - regulator_put(supply); - goto out; - } - } - out: return ret; } -- 2.47.3