summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/cpcap-regulator.c2
-rw-r--r--drivers/regulator/of_regulator.c13
-rw-r--r--drivers/regulator/twl-regulator.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c
index f541b80f1b54..bd910fe123d9 100644
--- a/drivers/regulator/cpcap-regulator.c
+++ b/drivers/regulator/cpcap-regulator.c
@@ -222,7 +222,7 @@ static unsigned int cpcap_map_mode(unsigned int mode)
222 case CPCAP_BIT_AUDIO_LOW_PWR: 222 case CPCAP_BIT_AUDIO_LOW_PWR:
223 return REGULATOR_MODE_STANDBY; 223 return REGULATOR_MODE_STANDBY;
224 default: 224 default:
225 return -EINVAL; 225 return REGULATOR_MODE_INVALID;
226 } 226 }
227} 227}
228 228
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index f47264fa1940..0d3f73eacb99 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -31,6 +31,7 @@ static void of_get_regulation_constraints(struct device_node *np,
31 struct regulation_constraints *constraints = &(*init_data)->constraints; 31 struct regulation_constraints *constraints = &(*init_data)->constraints;
32 struct regulator_state *suspend_state; 32 struct regulator_state *suspend_state;
33 struct device_node *suspend_np; 33 struct device_node *suspend_np;
34 unsigned int mode;
34 int ret, i; 35 int ret, i;
35 u32 pval; 36 u32 pval;
36 37
@@ -124,11 +125,11 @@ static void of_get_regulation_constraints(struct device_node *np,
124 125
125 if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) { 126 if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
126 if (desc && desc->of_map_mode) { 127 if (desc && desc->of_map_mode) {
127 ret = desc->of_map_mode(pval); 128 mode = desc->of_map_mode(pval);
128 if (ret == -EINVAL) 129 if (mode == REGULATOR_MODE_INVALID)
129 pr_err("%s: invalid mode %u\n", np->name, pval); 130 pr_err("%s: invalid mode %u\n", np->name, pval);
130 else 131 else
131 constraints->initial_mode = ret; 132 constraints->initial_mode = mode;
132 } else { 133 } else {
133 pr_warn("%s: mapping for mode %d not defined\n", 134 pr_warn("%s: mapping for mode %d not defined\n",
134 np->name, pval); 135 np->name, pval);
@@ -163,12 +164,12 @@ static void of_get_regulation_constraints(struct device_node *np,
163 if (!of_property_read_u32(suspend_np, "regulator-mode", 164 if (!of_property_read_u32(suspend_np, "regulator-mode",
164 &pval)) { 165 &pval)) {
165 if (desc && desc->of_map_mode) { 166 if (desc && desc->of_map_mode) {
166 ret = desc->of_map_mode(pval); 167 mode = desc->of_map_mode(pval);
167 if (ret == -EINVAL) 168 if (mode == REGULATOR_MODE_INVALID)
168 pr_err("%s: invalid mode %u\n", 169 pr_err("%s: invalid mode %u\n",
169 np->name, pval); 170 np->name, pval);
170 else 171 else
171 suspend_state->mode = ret; 172 suspend_state->mode = mode;
172 } else { 173 } else {
173 pr_warn("%s: mapping for mode %d not defined\n", 174 pr_warn("%s: mapping for mode %d not defined\n",
174 np->name, pval); 175 np->name, pval);
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index a4456db5849d..884c7505ed91 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -274,7 +274,7 @@ static inline unsigned int twl4030reg_map_mode(unsigned int mode)
274 case RES_STATE_SLEEP: 274 case RES_STATE_SLEEP:
275 return REGULATOR_MODE_STANDBY; 275 return REGULATOR_MODE_STANDBY;
276 default: 276 default:
277 return -EINVAL; 277 return REGULATOR_MODE_INVALID;
278 } 278 }
279} 279}
280 280