Skip to content

Commit ded06a5

Browse files
broonieLiam Girdwood
authored andcommitted
regulator: Only notify voltage changes when they succeed
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> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
1 parent e8eef82 commit ded06a5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎drivers/regulator/core.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,10 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
16671667
ret = -EINVAL;
16681668
}
16691669

1670+
if (ret == 0)
1671+
_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
1672+
NULL);
1673+
16701674
trace_regulator_set_voltage_complete(rdev_get_name(rdev), selector);
16711675

16721676
return ret;
@@ -1718,7 +1722,6 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
17181722
ret = _regulator_do_set_voltage(rdev, min_uV, max_uV);
17191723

17201724
out:
1721-
_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE, NULL);
17221725
mutex_unlock(&rdev->mutex);
17231726
return ret;
17241727
}

0 commit comments

Comments
 (0)