]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
power: regulator: max77686: Don't use switch() on bools
authorTom Rini <trini@konsulko.com>
Sun, 17 Jan 2016 02:44:37 +0000 (02:44 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 19 Jan 2016 13:32:00 +0000 (08:32 -0500)
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>
drivers/power/regulator/max77686.c

index 71678b60d3efdb064e2ed0ff52e0b61c8e6ef209..7479af734ade6617eb9ed3142c0323d25013fd85 100644 (file)
@@ -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)