From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Sangbeom Kim <sbkim73@samsung.com>, Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH RESEND 1/4] regulator: Fix setting new voltage in s5m8767_set_voltage
Date: Mon, 19 Mar 2012 12:22:10 +0800 [thread overview]
Message-ID: <1332130930.26765.2.camel@phoenix> (raw)
Current code does not really update the register with new value, fix it.
I rename the variable i to sel for better readability.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
Hi Sangbeom,
I make the following patchs on top of this one, so I resend this one as the
first patch of this serial.
I'd appreciate to have your feedback about the changes in this patch serial.
Thanks,
Axel
drivers/regulator/s5m8767.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 58447db..4ca2db0 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -311,8 +311,7 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev,
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
const struct s5m_voltage_desc *desc;
int reg_id = rdev_get_id(rdev);
- int reg, mask, ret;
- int i;
+ int sel, reg, mask, ret;
u8 val;
switch (reg_id) {
@@ -333,19 +332,20 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev,
desc = reg_voltage_map[reg_id];
- i = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV);
- if (i < 0)
- return i;
+ sel = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV);
+ if (sel < 0)
+ return sel;
ret = s5m8767_get_voltage_register(rdev, ®);
if (ret)
return ret;
s5m_reg_read(s5m8767->iodev, reg, &val);
- val = val & mask;
+ val &= ~mask;
+ val |= sel;
ret = s5m_reg_write(s5m8767->iodev, reg, val);
- *selector = i;
+ *selector = sel;
return ret;
}
--
1.7.5.4
next reply other threads:[~2012-03-19 4:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 4:22 Axel Lin [this message]
2012-03-19 4:23 ` [PATCH RFC 2/4] regulator: Rework s5m8767_set_voltage to support both LDOs and BUCKs Axel Lin
2012-04-02 23:16 ` Sangbeom Kim
2012-04-03 0:00 ` Axel Lin
2012-04-03 5:40 ` Sangbeom Kim
2012-03-19 4:24 ` [PATCH RFC 3/4] regulator: Use one s5m8767_ops for " Axel Lin
2012-04-03 5:42 ` Sangbeom Kim
2012-03-19 4:25 ` [PATCH RFC 4/4] regulator: Replace regulator_desc_[ldo|buck] by s5m8767_regulator_desc macro Axel Lin
2012-04-03 5:54 ` Sangbeom Kim
2012-03-29 12:41 ` [PATCH RESEND 1/4] regulator: Fix setting new voltage in s5m8767_set_voltage Axel Lin
2012-03-30 5:56 ` Sangbeom Kim
2012-03-31 10:33 ` 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=1332130930.26765.2.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sbkim73@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.