[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250828122737.43488-1-liaoyuanhong@vivo.com>
Date: Thu, 28 Aug 2025 20:27:37 +0800
From: Liao Yuanhong <liaoyuanhong@...o.com>
To: Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
linux-kernel@...r.kernel.org (open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK)
Cc: Liao Yuanhong <liaoyuanhong@...o.com>
Subject: [PATCH] regulator: core: Remove redundant ternary operators
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.
Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
---
drivers/regulator/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 554d83c4af0c..dd7b10e768c0 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1586,8 +1586,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
}
if (rdev->constraints->active_discharge && ops->set_active_discharge) {
- bool ad_state = (rdev->constraints->active_discharge ==
- REGULATOR_ACTIVE_DISCHARGE_ENABLE) ? true : false;
+ bool ad_state = rdev->constraints->active_discharge ==
+ REGULATOR_ACTIVE_DISCHARGE_ENABLE;
ret = ops->set_active_discharge(rdev, ad_state);
if (ret < 0) {
--
2.34.1
Powered by blists - more mailing lists