[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251001212709.579080-8-tommaso.merciai.xr@bp.renesas.com>
Date: Wed, 1 Oct 2025 23:26:51 +0200
From: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
To: tomm.merciai@...il.com
Cc: linux-renesas-soc@...r.kernel.org,
biju.das.jz@...renesas.com,
Tommaso Merciai <tommaso.merciai.xr@...renesas.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 07/18] regulator: devres: Disable exclusive regulator before releasing
Ensure that exclusive regulators are properly disabled when their reference
count drops to one before they are released. This prevents possible issues
where exclusive regulators may remain enabled unintentionally after being
put.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@...renesas.com>
---
drivers/regulator/devres.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
index 2cf03042fddf..48da9823ce2f 100644
--- a/drivers/regulator/devres.c
+++ b/drivers/regulator/devres.c
@@ -16,7 +16,13 @@
static void devm_regulator_release(struct device *dev, void *res)
{
- regulator_put(*(struct regulator **)res);
+ struct regulator *regulator = *(struct regulator **)res;
+ struct regulator_dev *rdev = regulator->rdev;
+
+ if (rdev->exclusive && regulator->enable_count == 1)
+ regulator_disable(regulator);
+
+ regulator_put(regulator);
}
static struct regulator *_devm_regulator_get(struct device *dev, const char *id,
--
2.43.0
Powered by blists - more mailing lists