linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: axp20x: Fix misleading use of negation
@ 2020-02-22 23:56 Ondrej Jirman
  2020-02-23  3:22 ` [linux-sunxi] " Chen-Yu Tsai
  0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Jirman @ 2020-02-22 23:56 UTC (permalink / raw)
  To: linux-sunxi
  Cc: 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 <megous@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [linux-sunxi] [PATCH] regulator: axp20x: Fix misleading use of negation
  2020-02-22 23:56 [PATCH] regulator: axp20x: Fix misleading use of negation Ondrej Jirman
@ 2020-02-23  3:22 ` Chen-Yu Tsai
  0 siblings, 0 replies; 2+ messages in thread
From: Chen-Yu Tsai @ 2020-02-23  3:22 UTC (permalink / raw)
  To: Ondřej Jirman
  Cc: linux-sunxi, Liam Girdwood, Mark Brown,
	open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK

On Sun, Feb 23, 2020 at 7:56 AM Ondrej Jirman <megous@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 <megous@megous.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-23  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 23:56 [PATCH] regulator: axp20x: Fix misleading use of negation Ondrej Jirman
2020-02-23  3:22 ` [linux-sunxi] " Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).