public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] regulator: return set_mode is same mode is requested
@ 2010-05-17 14:09 Sundar Iyer
  2010-05-17 14:35 ` Liam Girdwood
  2010-05-17 14:44 ` Mark Brown
  0 siblings, 2 replies; 10+ messages in thread
From: Sundar Iyer @ 2010-05-17 14:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: STEricsson_nomadik_linux, Sundar R Iyer, Liam Girdwood,
	Mark Brown, Linus Walleij

From: Sundar R Iyer <sundar.iyer@stericsson.com>

Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com>
---
 drivers/regulator/core.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 98e5d14..5054add 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1599,6 +1599,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 {
 	struct regulator_dev *rdev = regulator->rdev;
 	int ret;
+	int regulator_curr_mode;
 
 	mutex_lock(&rdev->mutex);
 
@@ -1754,6 +1755,13 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode)
 		goto out;
 	}
 
+	/* return if the same mode is requested */
+	regulator_curr_mode = rdev->desc->ops->get_mode(rdev);
+	if (regulator_curr_mode == mode) {
+		ret = 0;
+		goto out;
+	}
+
 	/* constraints check */
 	ret = regulator_check_mode(rdev, mode);
 	if (ret < 0)
-- 
1.7.0


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

end of thread, other threads:[~2010-05-17 19:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-17 14:09 [PATCH 1/1] regulator: return set_mode is same mode is requested Sundar Iyer
2010-05-17 14:35 ` Liam Girdwood
2010-05-17 14:44 ` Mark Brown
2010-05-17 14:56   ` Sundar R Iyer
2010-05-17 15:15     ` Sundar R Iyer
2010-05-17 15:34       ` Mark Brown
2010-05-17 15:54         ` Sundar R Iyer
2010-05-17 16:08           ` Mark Brown
2010-05-17 19:44           ` Liam Girdwood
2010-05-17 15:18     ` Sundar R Iyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox