lkml.org 
[lkml]   [2022]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regulator: tps65219: Fix is_enabled checking in tps65219_set_bypass
Date
Testing .enable cannot tell if a regulator is enabled or not, check return
value of .is_enabled() instead.
Also remove unneeded ret variable.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/tps65219-regulator.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index b198dcc60bc7..c484c943e467 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -181,16 +181,14 @@ static int tps65219_set_bypass(struct regulator_dev *dev, bool enable)
{
struct tps65219 *tps = rdev_get_drvdata(dev);
unsigned int rid = rdev_get_id(dev);
- int ret = 0;

- if (dev->desc->ops->enable) {
+ if (dev->desc->ops->is_enabled(dev)) {
dev_err(tps->dev,
"%s LDO%d enabled, must be shut down to set bypass ",
__func__, rid);
return -EBUSY;
}
- ret = regulator_set_bypass_regmap(dev, enable);
- return ret;
+ return regulator_set_bypass_regmap(dev, enable);
}

/* Operations permitted on BUCK1/2/3 */
--
2.34.1
\
 
 \ /
  Last update: 2022-09-19 14:24    [W:0.029 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site