lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1359695098-3630-1-git-send-email-j-keerthy@ti.com>
Date:	Fri, 1 Feb 2013 10:34:58 +0530
From:	J Keerthy <j-keerthy@...com>
To:	<linux-kernel@...r.kernel.org>, <lgirdwood@...il.com>,
	<broonie@...nsource.wolfsonmicro.com>
CC:	<j-keerthy@...com>
Subject: [PATCH] Regulator: Reorder the min max assignment in the sequence of regulator_set_voltage function

The min and max values for regulators are getting assigned before actually
the voltage is set. So making sure that min and max values are assigned
only if the voltage is successfully set else keeping the last successfully
set voltage's min and max values.

This is boot tested on OMAP4430 and OMAP4460 boards.

Signed-off-by: J Keerthy <j-keerthy@...com>
Cc: Mark Brown <broonie@...nsource.wolfsonmicro.com> 
---
 drivers/regulator/core.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 2785843..12140fb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -81,6 +81,8 @@ struct regulator {
 	int uA_load;
 	int min_uV;
 	int max_uV;
+	int curr_min_uV;
+	int curr_max_uV;
 	char *supply_name;
 	struct device_attribute dev_attr;
 	struct regulator_dev *rdev;
@@ -2315,6 +2317,8 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 	ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
 	if (ret < 0)
 		goto out;
+	regulator->curr_min_uV = regulator->min_uV;
+	regulator->curr_max_uV = regulator->max_uV;
 	regulator->min_uV = min_uV;
 	regulator->max_uV = max_uV;
 
@@ -2325,6 +2329,11 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
 
 out:
+	if (ret) {
+		regulator->min_uV = regulator->curr_min_uV;
+		regulator->max_uV = regulator->curr_max_uV;
+	}
+
 	mutex_unlock(&rdev->mutex);
 	return ret;
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ