Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 335649
b: refs/heads/master
c: f0f98b1
h: refs/heads/master
i:
  335647: f357351
v: v3
  • Loading branch information
Marek Szyprowski authored and Mark Brown committed Nov 15, 2012
1 parent 7352b2b commit c9bf542
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 23ff2f0f6128b4c310fbb274dbb91cc2f9b6ab06
refs/heads/master: f0f98b19e23d4426ca185e3d4ca80e6aff5ef51b
30 changes: 12 additions & 18 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,14 +1381,22 @@ struct regulator *regulator_get_exclusive(struct device *dev, const char *id)
}
EXPORT_SYMBOL_GPL(regulator_get_exclusive);

/* Locks held by regulator_put() */
static void _regulator_put(struct regulator *regulator)
/**
* regulator_put - "free" the regulator source
* @regulator: regulator source
*
* Note: drivers must ensure that all regulator_enable calls made on this
* regulator source are balanced by regulator_disable calls prior to calling
* this function.
*/
void regulator_put(struct regulator *regulator)
{
struct regulator_dev *rdev;

if (regulator == NULL || IS_ERR(regulator))
return;

mutex_lock(&regulator_list_mutex);
rdev = regulator->rdev;

debugfs_remove_recursive(regulator->debugfs);
Expand All @@ -1404,20 +1412,6 @@ static void _regulator_put(struct regulator *regulator)
rdev->exclusive = 0;

module_put(rdev->owner);
}

/**
* regulator_put - "free" the regulator source
* @regulator: regulator source
*
* Note: drivers must ensure that all regulator_enable calls made on this
* regulator source are balanced by regulator_disable calls prior to calling
* this function.
*/
void regulator_put(struct regulator *regulator)
{
mutex_lock(&regulator_list_mutex);
_regulator_put(regulator);
mutex_unlock(&regulator_list_mutex);
}
EXPORT_SYMBOL_GPL(regulator_put);
Expand Down Expand Up @@ -1980,7 +1974,7 @@ int regulator_is_supported_voltage(struct regulator *regulator,
if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
ret = regulator_get_voltage(regulator);
if (ret >= 0)
return (min_uV >= ret && ret <= max_uV);
return (min_uV <= ret && ret <= max_uV);
else
return ret;
}
Expand Down Expand Up @@ -3451,7 +3445,7 @@ regulator_register(const struct regulator_desc *regulator_desc,

scrub:
if (rdev->supply)
_regulator_put(rdev->supply);
regulator_put(rdev->supply);
if (rdev->ena_gpio)
gpio_free(rdev->ena_gpio);
kfree(rdev->constraints);
Expand Down

0 comments on commit c9bf542

Please sign in to comment.