diff options
author | Mark Brown <broonie@kernel.org> | 2015-08-30 09:38:46 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-30 09:38:46 -0400 |
commit | eaf018e170cef4a5a4378c984b70d768dd30048d (patch) | |
tree | 028421b3741276833cbe5cc3231771fae451ef02 | |
parent | e616e2f11b2776cbc24035fd14df4773a57b4b6a (diff) | |
parent | 099982fac0f3e884ed4af2178d4dcded69e0042e (diff) |
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
-rw-r--r-- | drivers/regulator/core.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 78387a6cbae5..584cbbd38d47 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -296,7 +296,7 @@ static int regulator_check_drms(struct regulator_dev *rdev) | |||
296 | return -ENODEV; | 296 | return -ENODEV; |
297 | } | 297 | } |
298 | if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { | 298 | if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) { |
299 | rdev_err(rdev, "operation not allowed\n"); | 299 | rdev_dbg(rdev, "operation not allowed\n"); |
300 | return -EPERM; | 300 | return -EPERM; |
301 | } | 301 | } |
302 | return 0; | 302 | return 0; |
@@ -641,6 +641,8 @@ static int drms_uA_update(struct regulator_dev *rdev) | |||
641 | int current_uA = 0, output_uV, input_uV, err; | 641 | int current_uA = 0, output_uV, input_uV, err; |
642 | unsigned int mode; | 642 | unsigned int mode; |
643 | 643 | ||
644 | lockdep_assert_held_once(&rdev->mutex); | ||
645 | |||
644 | /* | 646 | /* |
645 | * first check to see if we can set modes at all, otherwise just | 647 | * first check to see if we can set modes at all, otherwise just |
646 | * tell the consumer everything is OK. | 648 | * tell the consumer everything is OK. |
@@ -761,6 +763,8 @@ static int suspend_set_state(struct regulator_dev *rdev, | |||
761 | /* locks held by caller */ | 763 | /* locks held by caller */ |
762 | static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) | 764 | static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) |
763 | { | 765 | { |
766 | lockdep_assert_held_once(&rdev->mutex); | ||
767 | |||
764 | if (!rdev->constraints) | 768 | if (!rdev->constraints) |
765 | return -EINVAL; | 769 | return -EINVAL; |
766 | 770 | ||
@@ -1595,9 +1599,11 @@ static void _regulator_put(struct regulator *regulator) | |||
1595 | { | 1599 | { |
1596 | struct regulator_dev *rdev; | 1600 | struct regulator_dev *rdev; |
1597 | 1601 | ||
1598 | if (regulator == NULL || IS_ERR(regulator)) | 1602 | if (IS_ERR_OR_NULL(regulator)) |
1599 | return; | 1603 | return; |
1600 | 1604 | ||
1605 | lockdep_assert_held_once(®ulator_list_mutex); | ||
1606 | |||
1601 | rdev = regulator->rdev; | 1607 | rdev = regulator->rdev; |
1602 | 1608 | ||
1603 | debugfs_remove_recursive(regulator->debugfs); | 1609 | debugfs_remove_recursive(regulator->debugfs); |
@@ -1976,6 +1982,8 @@ static int _regulator_enable(struct regulator_dev *rdev) | |||
1976 | { | 1982 | { |
1977 | int ret; | 1983 | int ret; |
1978 | 1984 | ||
1985 | lockdep_assert_held_once(&rdev->mutex); | ||
1986 | |||
1979 | /* check voltage and requested load before enabling */ | 1987 | /* check voltage and requested load before enabling */ |
1980 | if (rdev->constraints && | 1988 | if (rdev->constraints && |
1981 | (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) | 1989 | (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) |
@@ -2076,6 +2084,8 @@ static int _regulator_disable(struct regulator_dev *rdev) | |||
2076 | { | 2084 | { |
2077 | int ret = 0; | 2085 | int ret = 0; |
2078 | 2086 | ||
2087 | lockdep_assert_held_once(&rdev->mutex); | ||
2088 | |||
2079 | if (WARN(rdev->use_count <= 0, | 2089 | if (WARN(rdev->use_count <= 0, |
2080 | "unbalanced disables for %s\n", rdev_get_name(rdev))) | 2090 | "unbalanced disables for %s\n", rdev_get_name(rdev))) |
2081 | return -EIO; | 2091 | return -EIO; |
@@ -2154,6 +2164,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev) | |||
2154 | { | 2164 | { |
2155 | int ret = 0; | 2165 | int ret = 0; |
2156 | 2166 | ||
2167 | lockdep_assert_held_once(&rdev->mutex); | ||
2168 | |||
2157 | ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | | 2169 | ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE | |
2158 | REGULATOR_EVENT_PRE_DISABLE, NULL); | 2170 | REGULATOR_EVENT_PRE_DISABLE, NULL); |
2159 | if (ret & NOTIFY_STOP_MASK) | 2171 | if (ret & NOTIFY_STOP_MASK) |
@@ -2722,7 +2734,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV) | |||
2722 | goto out; | 2734 | goto out; |
2723 | 2735 | ||
2724 | /* If we're trying to set a range that overlaps the current voltage, | 2736 | /* If we're trying to set a range that overlaps the current voltage, |
2725 | * return succesfully even though the regulator does not support | 2737 | * return successfully even though the regulator does not support |
2726 | * changing the voltage. | 2738 | * changing the voltage. |
2727 | */ | 2739 | */ |
2728 | if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { | 2740 | if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { |
@@ -3450,6 +3462,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free); | |||
3450 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | 3462 | int regulator_notifier_call_chain(struct regulator_dev *rdev, |
3451 | unsigned long event, void *data) | 3463 | unsigned long event, void *data) |
3452 | { | 3464 | { |
3465 | lockdep_assert_held_once(&rdev->mutex); | ||
3466 | |||
3453 | _notifier_call_chain(rdev, event, data); | 3467 | _notifier_call_chain(rdev, event, data); |
3454 | return NOTIFY_DONE; | 3468 | return NOTIFY_DONE; |
3455 | 3469 | ||
@@ -3824,11 +3838,11 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
3824 | WARN_ON(rdev->open_count); | 3838 | WARN_ON(rdev->open_count); |
3825 | unset_regulator_supplies(rdev); | 3839 | unset_regulator_supplies(rdev); |
3826 | list_del(&rdev->list); | 3840 | list_del(&rdev->list); |
3841 | mutex_unlock(®ulator_list_mutex); | ||
3827 | kfree(rdev->constraints); | 3842 | kfree(rdev->constraints); |
3828 | regulator_ena_gpio_free(rdev); | 3843 | regulator_ena_gpio_free(rdev); |
3829 | of_node_put(rdev->dev.of_node); | 3844 | of_node_put(rdev->dev.of_node); |
3830 | device_unregister(&rdev->dev); | 3845 | device_unregister(&rdev->dev); |
3831 | mutex_unlock(®ulator_list_mutex); | ||
3832 | } | 3846 | } |
3833 | EXPORT_SYMBOL_GPL(regulator_unregister); | 3847 | EXPORT_SYMBOL_GPL(regulator_unregister); |
3834 | 3848 | ||