summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max77620-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2016-02-25 14:40:09 +0800
committerMark Brown <broonie@kernel.org>2016-02-26 10:36:54 +0900
commitaad76f743b040fe1b113691e92a2983b39c1f114 (patch)
treef86467d9b75543e461d96ae7ed85b7673e31fb1b /drivers/regulator/max77620-regulator.c
parent47dbdbf64fd664eae237ef9b94f4bf89093fa5a3 (diff)
downloadlinux-stable-aad76f743b040fe1b113691e92a2983b39c1f114.tar.gz
linux-stable-aad76f743b040fe1b113691e92a2983b39c1f114.tar.bz2
linux-stable-aad76f743b040fe1b113691e92a2983b39c1f114.zip
regulator: max77620: Eliminate duplicate code
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/max77620-regulator.c')
-rw-r--r--drivers/regulator/max77620-regulator.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 761eb965f901..0eb5d18999e6 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: