drivers/power/regulator/max77686.c: Don't use switch() on bools
PATCH 1/1 drivers/power/regulator/max77686.c: 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.
--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
drivers/power/regulator/max77686.c +8 -20
@@ -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)
Signature · 1 line
2.7.0.rc3
PATCH 1/1 drivers/power/regulator/max77686.c: Don't use switch() on bools
Quoted 11 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
PATCH 1/1 drivers/power/regulator/max77686.c: Don't use switch() on bools
In reply to Tom RiniHello Tom,
Quoted 57 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)drivers/power/regulator/max77686.c +6
-16@@ -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)
drivers/power/regulator/max77686.c static int max77686_buck_enable(struct udevice *dev, int op, bool *enable) · line 654
Quoted 10 lines
drivers/power/regulator/max77686.c +2
-4on_off =OPMODE_ON ; -break ; -default : -return -EINVAL ; - } + else + on_off =OPMODE_OFF ; ret =max77686_buck_mode (dev, op, &on_off);if (ret)
Thank you for pointing that:)
Best regards,
Signature · 4 lines
Przemyslaw Marczak Samsung R&D Institute Poland Samsung Electronics p.marczak at samsung.com
PATCH 1/1 drivers/power/regulator/max77686.c: Don't use switch() on bools
In reply to Tom RiniHi
Quoted 11 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
I never seen subject that contains the path of a driver.
Michael
Quoted 62 lines
drivers/power/regulator/max77686.c +8
-21@@ -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) --2.7.0.rc3
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 1/1 drivers/power/regulator/max77686.c: Don't use switch() on bools
Quoted 15 lines · Michael Trimarchi
Hi
Quoted 11 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
Quoted 1 line
I never seen subject that contains the path of a driver.
Uncommon but done sometimes.
Quoted 73 lines
Michael
Quoted 62 lines
drivers/power/regulator/max77686.c +8
-21@@ -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) --2.7.0.rc3
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-bootSignature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160118/79bf7311/attachment.sig>
PATCH 1/1 drivers/power/regulator/max77686.c: Don't use switch() on bools
Hi
Quoted 16 lines · Tom Rini
Quoted 15 lines · Michael Trimarchi
Hi
Quoted 11 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>--- drivers/power/regulator/max77686.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
Quoted 4 lines
Quoted 1 line
I never seen subject that contains the path of a driver.
Uncommon but done sometimes.
Can you just fix it up and make more common? I think that patchwork in general organize better the emails too
Michael
Quoted 76 lines
Quoted 69 lines
Michael
Quoted 58 lines
drivers/power/regulator/max77686.c +8
-21@@ -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) --2.7.0.rc3
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot--
Quoted 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |--
Tom
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
Quoted 9 lines · Tom Rini
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 <[email protected]>Cc Przemyslaw Marczak <[email protected]>Signed-off-by Tom Rini <[email protected]>Reviewed-by Bin Meng <[email protected]>
Reworded the subject and applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160119/da783e1f/attachment.sig>