LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails
@ 2015-01-24  4:01 Axel Lin
  2015-01-26 19:11 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-01-24  4:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: Bjorn Andersson, Lee Jones, Liam Girdwood, linux-kernel

Ensure get_voltage return correct voltage if set_voltage fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/qcom_rpm-regulator.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/qcom_rpm-regulator.c b/drivers/regulator/qcom_rpm-regulator.c
index edd0a17..f48b3de 100644
--- a/drivers/regulator/qcom_rpm-regulator.c
+++ b/drivers/regulator/qcom_rpm-regulator.c
@@ -228,9 +228,11 @@ static int rpm_reg_set_mV_sel(struct regulator_dev *rdev,
 		return uV;
 
 	mutex_lock(&vreg->lock);
-	vreg->uV = uV;
 	if (vreg->is_enabled)
-		ret = rpm_reg_write(vreg, req, vreg->uV / 1000);
+		ret = rpm_reg_write(vreg, req, uV / 1000);
+
+	if (!ret)
+		vreg->uV = uV;
 	mutex_unlock(&vreg->lock);
 
 	return ret;
@@ -253,9 +255,11 @@ static int rpm_reg_set_uV_sel(struct regulator_dev *rdev,
 		return uV;
 
 	mutex_lock(&vreg->lock);
-	vreg->uV = uV;
 	if (vreg->is_enabled)
-		ret = rpm_reg_write(vreg, req, vreg->uV);
+		ret = rpm_reg_write(vreg, req, uV);
+
+	if (!ret)
+		vreg->uV = uV;
 	mutex_unlock(&vreg->lock);
 
 	return ret;
-- 
1.9.1




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails
  2015-01-24  4:01 [PATCH] regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails Axel Lin
@ 2015-01-26 19:11 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-01-26 19:11 UTC (permalink / raw)
  To: Axel Lin; +Cc: Bjorn Andersson, Lee Jones, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 142 bytes --]

On Sat, Jan 24, 2015 at 12:01:12PM +0800, Axel Lin wrote:
> Ensure get_voltage return correct voltage if set_voltage fails.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-26 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-24  4:01 [PATCH] regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails Axel Lin
2015-01-26 19:11 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).