aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@cam.ac.uk>2009-01-19 13:20:58 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-03-31 04:56:20 -0400
commitb136fb4463d13eea129bf090a8a465bba6bf0003 (patch)
tree48de26101e37833a79f6b3d62f4526dcca8f91fe /drivers/regulator/core.c
parent9485397aa2195e82da6373586a66689526675ad4 (diff)
Regulator: Push lock out of _notifier_call_chain + add voltage change event.
Regulator: Push lock out of _notifier_call_chain and into caller functions (side effect of fixing deadlock in regulator_force_disable) + Add a voltage changed event. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0ff95c3ccf5b..96c877dd9daf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1284,6 +1284,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
1284 ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV); 1284 ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV);
1285 1285
1286out: 1286out:
1287 _notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE, NULL);
1287 mutex_unlock(&rdev->mutex); 1288 mutex_unlock(&rdev->mutex);
1288 return ret; 1289 return ret;
1289} 1290}
@@ -1584,20 +1585,23 @@ int regulator_unregister_notifier(struct regulator *regulator,
1584} 1585}
1585EXPORT_SYMBOL_GPL(regulator_unregister_notifier); 1586EXPORT_SYMBOL_GPL(regulator_unregister_notifier);
1586 1587
1587/* notify regulator consumers and downstream regulator consumers */ 1588/* notify regulator consumers and downstream regulator consumers.
1589 * Note mutex must be held by caller.
1590 */
1588static void _notifier_call_chain(struct regulator_dev *rdev, 1591static void _notifier_call_chain(struct regulator_dev *rdev,
1589 unsigned long event, void *data) 1592 unsigned long event, void *data)
1590{ 1593{
1591 struct regulator_dev *_rdev; 1594 struct regulator_dev *_rdev;
1592 1595
1593 /* call rdev chain first */ 1596 /* call rdev chain first */
1594 mutex_lock(&rdev->mutex);
1595 blocking_notifier_call_chain(&rdev->notifier, event, NULL); 1597 blocking_notifier_call_chain(&rdev->notifier, event, NULL);
1596 mutex_unlock(&rdev->mutex);
1597 1598
1598 /* now notify regulator we supply */ 1599 /* now notify regulator we supply */
1599 list_for_each_entry(_rdev, &rdev->supply_list, slist) 1600 list_for_each_entry(_rdev, &rdev->supply_list, slist) {
1600 _notifier_call_chain(_rdev, event, data); 1601 mutex_lock(&_rdev->mutex);
1602 _notifier_call_chain(_rdev, event, data);
1603 mutex_unlock(&_rdev->mutex);
1604 }
1601} 1605}
1602 1606
1603/** 1607/**
@@ -1744,6 +1748,7 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free);
1744 * 1748 *
1745 * Called by regulator drivers to notify clients a regulator event has 1749 * Called by regulator drivers to notify clients a regulator event has
1746 * occurred. We also notify regulator clients downstream. 1750 * occurred. We also notify regulator clients downstream.
1751 * Note lock must be held by caller.
1747 */ 1752 */
1748int regulator_notifier_call_chain(struct regulator_dev *rdev, 1753int regulator_notifier_call_chain(struct regulator_dev *rdev,
1749 unsigned long event, void *data) 1754 unsigned long event, void *data)