public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: Only notify voltage changes when they succeed
@ 2010-12-16 13:59 Mark Brown
  2010-12-17 10:42 ` Liam Girdwood
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2010-12-16 13:59 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Saravana Kannan, linux-kernel, patches, Mark Brown

Currently we notify a voltage change whenever we exit set_voltage(),
even if the change failed for some reason (eg, a constraints issue).
This shouldn't cause any substantial ill effects but is wasteful as
listeners get notified on noops. Fix this by moving the notification
into _do_set_voltage() and only notifying if we don't return an error.

Reported-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/regulator/core.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a0579f0..3d72cc8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1667,6 +1667,10 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 		ret = -EINVAL;
 	}
 
+	if (ret == 0)
+		_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
+				     NULL);
+
 	trace_regulator_set_voltage_complete(rdev_get_name(rdev), selector);
 
 	return ret;
@@ -1718,7 +1722,6 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
 	ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
 
 out:
-	_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE, NULL);
 	mutex_unlock(&rdev->mutex);
 	return ret;
 }
-- 
1.7.1


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

* Re: [PATCH] regulator: Only notify voltage changes when they succeed
  2010-12-16 13:59 [PATCH] regulator: Only notify voltage changes when they succeed Mark Brown
@ 2010-12-17 10:42 ` Liam Girdwood
  0 siblings, 0 replies; 2+ messages in thread
From: Liam Girdwood @ 2010-12-17 10:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Saravana Kannan, linux-kernel, patches

On Thu, 2010-12-16 at 13:59 +0000, Mark Brown wrote:
> Currently we notify a voltage change whenever we exit set_voltage(),
> even if the change failed for some reason (eg, a constraints issue).
> This shouldn't cause any substantial ill effects but is wasteful as
> listeners get notified on noops. Fix this by moving the notification
> into _do_set_voltage() and only notifying if we don't return an error.
> 
> Reported-by: Saravana Kannan <skannan@codeaurora.org>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/regulator/core.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


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

end of thread, other threads:[~2010-12-17 10:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 13:59 [PATCH] regulator: Only notify voltage changes when they succeed Mark Brown
2010-12-17 10:42 ` Liam Girdwood

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