Commit eaf018e1 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'regulator/topic/core' into regulator-next

parents e616e2f1 099982fa
...@@ -296,7 +296,7 @@ static int regulator_check_drms(struct regulator_dev *rdev) ...@@ -296,7 +296,7 @@ static int regulator_check_drms(struct regulator_dev *rdev)
return -ENODEV; return -ENODEV;
} }
if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
rdev_err(rdev, "operation not allowed\n"); rdev_dbg(rdev, "operation not allowed\n");
return -EPERM; return -EPERM;
} }
return 0; return 0;
...@@ -641,6 +641,8 @@ static int drms_uA_update(struct regulator_dev *rdev) ...@@ -641,6 +641,8 @@ static int drms_uA_update(struct regulator_dev *rdev)
int current_uA = 0, output_uV, input_uV, err; int current_uA = 0, output_uV, input_uV, err;
unsigned int mode; unsigned int mode;
lockdep_assert_held_once(&rdev->mutex);
/* /*
* first check to see if we can set modes at all, otherwise just * first check to see if we can set modes at all, otherwise just
* tell the consumer everything is OK. * tell the consumer everything is OK.
...@@ -761,6 +763,8 @@ static int suspend_set_state(struct regulator_dev *rdev, ...@@ -761,6 +763,8 @@ static int suspend_set_state(struct regulator_dev *rdev,
/* locks held by caller */ /* locks held by caller */
static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
{ {
lockdep_assert_held_once(&rdev->mutex);
if (!rdev->constraints) if (!rdev->constraints)
return -EINVAL; return -EINVAL;
...@@ -1595,9 +1599,11 @@ static void _regulator_put(struct regulator *regulator) ...@@ -1595,9 +1599,11 @@ static void _regulator_put(struct regulator *regulator)
{ {
struct regulator_dev *rdev; struct regulator_dev *rdev;
if (regulator == NULL || IS_ERR(regulator)) if (IS_ERR_OR_NULL(regulator))
return; return;
lockdep_assert_held_once(&regulator_list_mutex);
rdev = regulator->rdev; rdev = regulator->rdev;
debugfs_remove_recursive(regulator->debugfs); debugfs_remove_recursive(regulator->debugfs);
...@@ -1976,6 +1982,8 @@ static int _regulator_enable(struct regulator_dev *rdev) ...@@ -1976,6 +1982,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
{ {
int ret; int ret;
lockdep_assert_held_once(&rdev->mutex);
/* check voltage and requested load before enabling */ /* check voltage and requested load before enabling */
if (rdev->constraints && if (rdev->constraints &&
(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS))
...@@ -2076,6 +2084,8 @@ static int _regulator_disable(struct regulator_dev *rdev) ...@@ -2076,6 +2084,8 @@ static int _regulator_disable(struct regulator_dev *rdev)
{ {
int ret = 0; int ret = 0;
lockdep_assert_held_once(&rdev->mutex);
if (WARN(rdev->use_count <= 0, if (WARN(rdev->use_count <= 0,
"unbalanced disables for %s\n", rdev_get_name(rdev))) "unbalanced disables for %s\n", rdev_get_name(rdev)))
return -EIO; return -EIO;
...@@ -2154,6 +2164,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev) ...@@ -2154,6 +2164,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
{ {
int ret = 0; int ret = 0;
lockdep_assert_held_once(&rdev->mutex);
ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
REGULATOR_EVENT_PRE_DISABLE, NULL); REGULATOR_EVENT_PRE_DISABLE, NULL);
if (ret & NOTIFY_STOP_MASK) if (ret & NOTIFY_STOP_MASK)
...@@ -2722,7 +2734,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV) ...@@ -2722,7 +2734,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
goto out; goto out;
/* If we're trying to set a range that overlaps the current voltage, /* If we're trying to set a range that overlaps the current voltage,
* return succesfully even though the regulator does not support * return successfully even though the regulator does not support
* changing the voltage. * changing the voltage.
*/ */
if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
...@@ -3450,6 +3462,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free); ...@@ -3450,6 +3462,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free);
int regulator_notifier_call_chain(struct regulator_dev *rdev, int regulator_notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data) unsigned long event, void *data)
{ {
lockdep_assert_held_once(&rdev->mutex);
_notifier_call_chain(rdev, event, data); _notifier_call_chain(rdev, event, data);
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -3824,11 +3838,11 @@ void regulator_unregister(struct regulator_dev *rdev) ...@@ -3824,11 +3838,11 @@ void regulator_unregister(struct regulator_dev *rdev)
WARN_ON(rdev->open_count); WARN_ON(rdev->open_count);
unset_regulator_supplies(rdev); unset_regulator_supplies(rdev);
list_del(&rdev->list); list_del(&rdev->list);
mutex_unlock(&regulator_list_mutex);
kfree(rdev->constraints); kfree(rdev->constraints);
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
of_node_put(rdev->dev.of_node); of_node_put(rdev->dev.of_node);
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
mutex_unlock(&regulator_list_mutex);
} }
EXPORT_SYMBOL_GPL(regulator_unregister); EXPORT_SYMBOL_GPL(regulator_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment