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

This commit is contained in:
Mark Brown 2015-08-30 14:38:46 +01:00
commit eaf018e170

View File

@ -296,7 +296,7 @@ static int regulator_check_drms(struct regulator_dev *rdev)
return -ENODEV;
}
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 0;
@ -641,6 +641,8 @@ static int drms_uA_update(struct regulator_dev *rdev)
int current_uA = 0, output_uV, input_uV, err;
unsigned int mode;
lockdep_assert_held_once(&rdev->mutex);
/*
* first check to see if we can set modes at all, otherwise just
* tell the consumer everything is OK.
@ -761,6 +763,8 @@ static int suspend_set_state(struct regulator_dev *rdev,
/* locks held by caller */
static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
{
lockdep_assert_held_once(&rdev->mutex);
if (!rdev->constraints)
return -EINVAL;
@ -1595,9 +1599,11 @@ static void _regulator_put(struct regulator *regulator)
{
struct regulator_dev *rdev;
if (regulator == NULL || IS_ERR(regulator))
if (IS_ERR_OR_NULL(regulator))
return;
lockdep_assert_held_once(&regulator_list_mutex);
rdev = regulator->rdev;
debugfs_remove_recursive(regulator->debugfs);
@ -1976,6 +1982,8 @@ static int _regulator_enable(struct regulator_dev *rdev)
{
int ret;
lockdep_assert_held_once(&rdev->mutex);
/* check voltage and requested load before enabling */
if (rdev->constraints &&
(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS))
@ -2076,6 +2084,8 @@ static int _regulator_disable(struct regulator_dev *rdev)
{
int ret = 0;
lockdep_assert_held_once(&rdev->mutex);
if (WARN(rdev->use_count <= 0,
"unbalanced disables for %s\n", rdev_get_name(rdev)))
return -EIO;
@ -2154,6 +2164,8 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
{
int ret = 0;
lockdep_assert_held_once(&rdev->mutex);
ret = _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
REGULATOR_EVENT_PRE_DISABLE, NULL);
if (ret & NOTIFY_STOP_MASK)
@ -2722,7 +2734,7 @@ int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
goto out;
/* 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.
*/
if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
@ -3450,6 +3462,8 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free);
int regulator_notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data)
{
lockdep_assert_held_once(&rdev->mutex);
_notifier_call_chain(rdev, event, data);
return NOTIFY_DONE;
@ -3824,11 +3838,11 @@ void regulator_unregister(struct regulator_dev *rdev)
WARN_ON(rdev->open_count);
unset_regulator_supplies(rdev);
list_del(&rdev->list);
mutex_unlock(&regulator_list_mutex);
kfree(rdev->constraints);
regulator_ena_gpio_free(rdev);
of_node_put(rdev->dev.of_node);
device_unregister(&rdev->dev);
mutex_unlock(&regulator_list_mutex);
}
EXPORT_SYMBOL_GPL(regulator_unregister);