aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/regulator/devres.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-02-03 13:56:02 -0800
committerMark Brown <broonie@kernel.org>2017-02-04 11:31:52 +0100
commita8bd42a97741aefa5942605fa87418fc8a6c4169 (patch)
tree1fa5d8f7469d632e3ceed41d8d2687bd35e0f1ab /drivers/regulator/devres.c
parentregulator: core: remove dead code in _regulator_get() (diff)
downloadwireguard-linux-a8bd42a97741aefa5942605fa87418fc8a6c4169.tar.xz
wireguard-linux-a8bd42a97741aefa5942605fa87418fc8a6c4169.zip
regulator: core: have _regulator_get() accept get_type argument
Instead of separate "exclusive" and "allow_dummy" arguments, that formed 3 valid combinations (normal, exclusive and optional) and an invalid one, let's accept explicit "get_type", like we did in devm-managed code. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/devres.c')
-rw-r--r--drivers/regulator/devres.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
index 6ec1d400adae..965d1d31ec8c 100644
--- a/drivers/regulator/devres.c
+++ b/drivers/regulator/devres.c
@@ -19,12 +19,6 @@
#include "internal.h"
-enum {
- NORMAL_GET,
- EXCLUSIVE_GET,
- OPTIONAL_GET,
-};
-
static void devm_regulator_release(struct device *dev, void *res)
{
regulator_put(*(struct regulator **)res);
@@ -39,20 +33,7 @@ static struct regulator *_devm_regulator_get(struct device *dev, const char *id,
if (!ptr)
return ERR_PTR(-ENOMEM);
- switch (get_type) {
- case NORMAL_GET:
- regulator = regulator_get(dev, id);
- break;
- case EXCLUSIVE_GET:
- regulator = regulator_get_exclusive(dev, id);
- break;
- case OPTIONAL_GET:
- regulator = regulator_get_optional(dev, id);
- break;
- default:
- regulator = ERR_PTR(-EINVAL);
- }
-
+ regulator = _regulator_get(dev, id, get_type);
if (!IS_ERR(regulator)) {
*ptr = regulator;
devres_add(dev, ptr);