Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Axel Lin and committed by
Mark Brown
be446f18 5bf2a9e7

+3 -6
+3 -6
drivers/regulator/da9062-regulator.c
··· 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 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: ··· 161 162 return 0; 162 163 163 164 if (val) 164 - mode &= REGULATOR_MODE_STANDBY; 165 + return REGULATOR_MODE_STANDBY; 165 166 else 166 - mode &= REGULATOR_MODE_NORMAL | REGULATOR_MODE_FAST; 167 - 168 - return mode; 167 + return REGULATOR_MODE_FAST; 169 168 } 170 169 171 170 /*