public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Jaewon Kim <jaewon02.kim@samsung.com>,
	Beomho Seo <beomho.seo@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap
Date: Fri, 01 May 2015 14:17:21 +0800	[thread overview]
Message-ID: <1430461041.4848.2.camel@ingics.com> (raw)
In-Reply-To: <1430460999.4848.1.camel@ingics.com>

Use regulator_is_enabled_regmap() to replace max77843_reg_is_enabled().

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

diff --git a/drivers/regulator/max77843.c b/drivers/regulator/max77843.c
index 3ae2a9b..f4fd0d3 100644
--- a/drivers/regulator/max77843.c
+++ b/drivers/regulator/max77843.c
@@ -33,21 +33,6 @@ static const unsigned int max77843_safeout_voltage_table[] = {
 	3300000,
 };
 
-static int max77843_reg_is_enabled(struct regulator_dev *rdev)
-{
-	struct regmap *regmap = rdev->regmap;
-	int ret;
-	unsigned int reg;
-
-	ret = regmap_read(regmap, rdev->desc->enable_reg, &reg);
-	if (ret) {
-		dev_err(&rdev->dev, "Fialed to read charger register\n");
-		return ret;
-	}
-
-	return (reg & rdev->desc->enable_mask) == rdev->desc->enable_mask;
-}
-
 static int max77843_reg_get_current_limit(struct regulator_dev *rdev)
 {
 	struct regmap *regmap = rdev->regmap;
@@ -96,7 +81,7 @@ static int max77843_reg_set_current_limit(struct regulator_dev *rdev,
 }
 
 static struct regulator_ops max77843_charger_ops = {
-	.is_enabled		= max77843_reg_is_enabled,
+	.is_enabled		= regulator_is_enabled_regmap,
 	.enable			= regulator_enable_regmap,
 	.disable		= regulator_disable_regmap,
 	.get_current_limit	= max77843_reg_get_current_limit,
@@ -141,6 +126,7 @@ static const struct regulator_desc max77843_supported_regulators[] = {
 		.owner		= THIS_MODULE,
 		.enable_reg	= MAX77843_CHG_REG_CHG_CNFG_00,
 		.enable_mask	= MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK,
+		.enable_val	= MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK,
 	},
 };
 
-- 
2.1.0




  reply	other threads:[~2015-05-01  6:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01  6:16 [RFT][PATCH 1/2] regulator: max77843: Fix enable_mask for max77843 charger Axel Lin
2015-05-01  6:17 ` Axel Lin [this message]
2015-05-01  7:56   ` [RFT][PATCH 2/2] regulator: max77843: Convert to use regulator_is_enabled_regmap Krzysztof Kozłowski
     [not found]   ` <CAJKOXPckcNq-2R_jn1f=d6ph23_EjbKuJ+4MRdFYkBF0q1018g@mail.gmail.com>
2015-05-04 12:28     ` Mark Brown
2015-05-04 13:56       ` Krzysztof Kozłowski

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=1430461041.4848.2.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=beomho.seo@samsung.com \
    --cc=broonie@kernel.org \
    --cc=jaewon02.kim@samsung.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