diff options
author | Tom Rini <trini@konsulko.com> | 2016-01-17 02:44:37 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-01-19 08:32:00 -0500 |
commit | 6d6aececfeb3eb96304e073b910681c7e12b66ca (patch) | |
tree | acfd3df59909943b0f8cbcb7b1865dd4a044bc04 | |
parent | 22bd03a6a21d116a60f3b3529c7bd5d6e86a1d46 (diff) | |
download | u-boot-imx-6d6aececfeb3eb96304e073b910681c7e12b66ca.zip u-boot-imx-6d6aececfeb3eb96304e073b910681c7e12b66ca.tar.gz u-boot-imx-6d6aececfeb3eb96304e073b910681c7e12b66ca.tar.bz2 |
power: regulator: max77686: Don't use switch() on bools
With gcc-5.3 we get a warning for using switch() on a bool type.
Rewrite these sections as if/else and update the one section that was
using 1/0 instead of true/false.
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
-rw-r--r-- | drivers/power/regulator/max77686.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index 71678b6..7479af7 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) |