Commit be446f183ae35a8c76687ea8203fdd86f3f9678e

Authored by Axel Lin
Committed by Mark Brown
1 parent 5bf2a9e7d3

regulator: da9062: Simplify da9062_buck_set_mode for BUCK_MODE_MANUAL case

The sleep flag bit decides the mode for BUCK_MODE_MANUAL case, simplify
the logic as the result is the same.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20191007115009.25672-2-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Showing 1 changed file with 3 additions and 6 deletions Side-by-side Diff

drivers/regulator/da9062-regulator.c
... ... @@ -136,7 +136,7 @@
136 136 static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
137 137 {
138 138 struct da9062_regulator *regl = rdev_get_drvdata(rdev);
139   - unsigned int val, mode = 0;
  139 + unsigned int val;
140 140 int ret;
141 141  
142 142 ret = regmap_field_read(regl->mode, &val);
... ... @@ -146,7 +146,6 @@
146 146 switch (val) {
147 147 default:
148 148 case BUCK_MODE_MANUAL:
149   - mode = REGULATOR_MODE_FAST | REGULATOR_MODE_STANDBY;
150 149 /* Sleep flag bit decides the mode */
151 150 break;
152 151 case BUCK_MODE_SLEEP:
153 152  
... ... @@ -162,11 +161,9 @@
162 161 return 0;
163 162  
164 163 if (val)
165   - mode &= REGULATOR_MODE_STANDBY;
  164 + return REGULATOR_MODE_STANDBY;
166 165 else
167   - mode &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST;
168   -
169   - return mode;
  166 + return REGULATOR_MODE_FAST;
170 167 }
171 168  
172 169 /*