summaryrefslogtreecommitdiffstats
path: root/configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
diff options
context:
space:
mode:
Diffstat (limited to 'configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch')
-rw-r--r--configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch73
1 files changed, 0 insertions, 73 deletions
diff --git a/configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch b/configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
deleted file mode 100644
index 0ccafda..0000000
--- a/configs/platform-v7a/patches/barebox-2020.01.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From: Sascha Hauer <s.hauer@pengutronix.de>
-Date: Thu, 19 Dec 2019 19:27:58 +0100
-Subject: [PATCH] regulator: add function to get regulator by its name
-
-Useful for getting regulators that are not correctly associated with a
-device.
-
-Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
----
- drivers/regulator/core.c | 30 +++++++++++++++++++++++++++++-
- include/regulator.h | 1 +
- 2 files changed, 30 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
-index 4ca035ae9476..f0de7a52e391 100644
---- a/drivers/regulator/core.c
-+++ b/drivers/regulator/core.c
-@@ -327,6 +327,34 @@ struct regulator *regulator_get(struct device_d *dev, const char *supply)
- return r;
- }
-
-+static struct regulator_internal *regulator_by_name(const char *name)
-+{
-+ struct regulator_internal *ri;
-+
-+ list_for_each_entry(ri, &regulator_list, list)
-+ if (ri->name && !strcmp(ri->name, name))
-+ return ri;
-+
-+ return NULL;
-+}
-+
-+struct regulator *regulator_get_name(const char *name)
-+{
-+ struct regulator_internal *ri;
-+ struct regulator *r;
-+
-+ ri = regulator_by_name(name);
-+ if (!ri)
-+ return ERR_PTR(-ENODEV);
-+
-+ r = xzalloc(sizeof(*r));
-+ r->ri = ri;
-+
-+ list_add_tail(&r->list, &ri->consumer_list);
-+
-+ return r;
-+}
-+
- /*
- * regulator_enable - enable a regulator.
- * @r: the regulator to enable
-@@ -379,7 +407,7 @@ static void regulator_print_one(struct regulator_internal *ri)
- printf(" consumers:\n");
-
- list_for_each_entry(r, &ri->consumer_list, list)
-- printf(" %s\n", dev_name(r->dev));
-+ printf(" %s\n", r->dev ? dev_name(r->dev) : "none");
- }
- }
-
-diff --git a/include/regulator.h b/include/regulator.h
-index 156acb82f8df..a445c5c3d10a 100644
---- a/include/regulator.h
-+++ b/include/regulator.h
-@@ -116,6 +116,7 @@ void regulators_print(void);
- #ifdef CONFIG_REGULATOR
-
- struct regulator *regulator_get(struct device_d *, const char *);
-+struct regulator *regulator_get_name(const char *name);
- int regulator_enable(struct regulator *);
- int regulator_disable(struct regulator *);
- int regulator_is_enabled_regmap(struct regulator_dev *);