summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-01-03 13:03:36 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-11-24 10:28:24 +0100
commit27f74d69f4bd21a4a823f4fa77876b9a64fa479f (patch)
tree966fc500e68e0c9495fc54186843510c235be2d0 /drivers/regulator/core.c
parentdd41ce3ecafc601d22e5c0148c342a14f592d48e (diff)
downloadbarebox-27f74d69f4bd21a4a823f4fa77876b9a64fa479f.tar.gz
barebox-27f74d69f4bd21a4a823f4fa77876b9a64fa479f.tar.xz
commands: regulator: add support for enabling/disabling regulators
For testing regulator drivers, it can be handy to enable/disable them from the shell prompt. Extend the regulator command to support this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120336.1729791-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index faf75c94ba..b20a48e0f6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -502,6 +502,14 @@ struct regulator *regulator_get(struct device *dev, const char *supply)
return r;
}
+void regulator_put(struct regulator *r)
+{
+ if (IS_ERR_OR_NULL(r))
+ return;
+ list_del(&r->list);
+ free(r);
+}
+
static struct regulator_dev *regulator_by_name(const char *name)
{
struct regulator_dev *rdev;