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: Laxman Dewangan <ldewangan@nvidia.com>,
	Mallikarjun Kasoju <mkasoju@nvidia.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] regulator: max77620: Eliminate duplicate code
Date: Thu, 25 Feb 2016 14:40:09 +0800	[thread overview]
Message-ID: <1456382409.30292.2.camel@ingics.com> (raw)
In-Reply-To: <1456382369.30292.1.camel@ingics.com>

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/max77620-regulator.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 761eb96..0eb5d18 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -264,15 +264,15 @@ static int max77620_read_slew_rate(struct max77620_regulator *pmic, int id)
 	int slew_rate;
 	int ret;
 
+	ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
+	if (ret < 0) {
+		dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
+			rinfo->cfg_addr, ret);
+		return ret;
+	}
+
 	switch (rinfo->type) {
 	case MAX77620_REGULATOR_TYPE_SD:
-		ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
-		if (ret < 0) {
-			dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
-				rinfo->cfg_addr, ret);
-			return ret;
-		}
-
 		slew_rate = (rval >> MAX77620_SD_SR_SHIFT) & 0x3;
 		switch (slew_rate) {
 		case 0:
@@ -291,12 +291,6 @@ static int max77620_read_slew_rate(struct max77620_regulator *pmic, int id)
 		rinfo->desc.ramp_delay = slew_rate;
 		break;
 	default:
-		ret = regmap_read(pmic->rmap, rinfo->cfg_addr, &rval);
-		if (ret < 0) {
-			dev_err(pmic->dev, "Register 0x%02x read failed: %d\n",
-				rinfo->cfg_addr, ret);
-			return ret;
-		}
 		slew_rate = rval & 0x1;
 		switch (slew_rate) {
 		case 0:
-- 
2.1.4

  reply	other threads:[~2016-02-25  6:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25  6:39 [PATCH 1/3] regulator: max77620: Remove unused fields Axel Lin
2016-02-25  6:40 ` Axel Lin [this message]
2016-02-25  6:40 ` [PATCH 3/3] regulator: max77620: Remove duplicate module alias Axel Lin

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=1456382409.30292.2.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkasoju@nvidia.com \
    /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

Powered by JetHome