mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Jerome Neanne <jneanne@baylibre.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Axel Lin <axel.lin@ingics.com>
Subject: [PATCH] regulator: tps65219: Fix is_enabled checking in tps65219_set_bypass
Date: Mon, 19 Sep 2022 20:23:53 +0800	[thread overview]
Message-ID: <20220919122353.384171-1-axel.lin@ingics.com> (raw)

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


             reply	other threads:[~2022-09-19 12:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 12:23 Axel Lin [this message]
2022-09-27 11:20 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220919122353.384171-1-axel.lin@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=jneanne@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®