summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/regulator/max77686.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c
index 71678b60d3..7479af734a 100644
--- a/drivers/power/regulator/max77686.c
+++ b/drivers/power/regulator/max77686.c
@@ -515,25 +515,19 @@ static int max77686_ldo_enable(struct udevice *dev, int op, bool *enable)
switch (on_off) {
case OPMODE_OFF:
- *enable = 0;
+ *enable = false;
break;
case OPMODE_ON:
- *enable = 1;
+ *enable = true;
break;
default:
return -EINVAL;
}
} else if (op == PMIC_OP_SET) {
- switch (*enable) {
- case 0:
- on_off = OPMODE_OFF;
- break;
- case 1:
+ if (*enable)
on_off = OPMODE_ON;
- break;
- default:
- return -EINVAL;
- }
+ else
+ on_off = OPMODE_OFF;
ret = max77686_ldo_mode(dev, op, &on_off);
if (ret)
@@ -651,16 +645,10 @@ static int max77686_buck_enable(struct udevice *dev, int op, bool *enable)
return -EINVAL;
}
} else if (op == PMIC_OP_SET) {
- switch (*enable) {
- case 0:
- on_off = OPMODE_OFF;
- break;
- case 1:
+ if (*enable)
on_off = OPMODE_ON;
- break;
- default:
- return -EINVAL;
- }
+ else
+ on_off = OPMODE_OFF;
ret = max77686_buck_mode(dev, op, &on_off);
if (ret)