[PATCH] regulator: axp20x: Fix misleading use of negation

12 views
Skip to first unread message

Ondrej Jirman

unread,
Feb 22, 2020, 6:56:40 PM2/22/20
to linux...@googlegroups.com, Ondrej Jirman, Liam Girdwood, Mark Brown, Chen-Yu Tsai, open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK
It works incidentally, because AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN
is non-zero, but the false branch value really should be just 0.

Signed-off-by: Ondrej Jirman <meg...@megous.com>
---
drivers/regulator/axp20x-regulator.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 16f0c85700360..1e6eb5b1f8d85 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -381,8 +381,7 @@ static int axp20x_set_ramp_delay(struct regulator_dev *rdev, int ramp)
mask = AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_RATE_MASK |
AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN_MASK;
enable = (ramp > 0) ?
- AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN :
- !AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN;
+ AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN : 0;
break;
}

@@ -393,8 +392,7 @@ static int axp20x_set_ramp_delay(struct regulator_dev *rdev, int ramp)
mask = AXP20X_DCDC2_LDO3_V_RAMP_LDO3_RATE_MASK |
AXP20X_DCDC2_LDO3_V_RAMP_LDO3_EN_MASK;
enable = (ramp > 0) ?
- AXP20X_DCDC2_LDO3_V_RAMP_LDO3_EN :
- !AXP20X_DCDC2_LDO3_V_RAMP_LDO3_EN;
+ AXP20X_DCDC2_LDO3_V_RAMP_LDO3_EN : 0;
break;
}

--
2.25.1

Chen-Yu Tsai

unread,
Feb 22, 2020, 10:22:57 PM2/22/20
to Ondřej Jirman, linux-sunxi, Liam Girdwood, Mark Brown, open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK
On Sun, Feb 23, 2020 at 7:56 AM Ondrej Jirman <meg...@megous.com> wrote:
>
> It works incidentally, because AXP20X_DCDC2_LDO3_V_RAMP_DCDC2_EN
> is non-zero, but the false branch value really should be just 0.
>
> Signed-off-by: Ondrej Jirman <meg...@megous.com>

Acked-by: Chen-Yu Tsai <we...@csie.org>
Reply all
Reply to author
Forward
0 new messages