Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165388
b: refs/heads/master
c: 9332546
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Sep 22, 2009
1 parent d278dec commit 1282a21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 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: f25e0b4fcc38d120e704c377791158c4b2a54daa
refs/heads/master: 9332546fe88fa88bf6a7d9b1dce53ff5d314934e
30 changes: 16 additions & 14 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,13 @@ static ssize_t regulator_state_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct regulator_dev *rdev = dev_get_drvdata(dev);
ssize_t ret;

mutex_lock(&rdev->mutex);
ret = regulator_print_state(buf, _regulator_is_enabled(rdev));
mutex_unlock(&rdev->mutex);

return regulator_print_state(buf, _regulator_is_enabled(rdev));
return ret;
}
static DEVICE_ATTR(state, 0444, regulator_state_show, NULL);

Expand Down Expand Up @@ -1365,20 +1370,11 @@ EXPORT_SYMBOL_GPL(regulator_force_disable);

static int _regulator_is_enabled(struct regulator_dev *rdev)
{
int ret;

mutex_lock(&rdev->mutex);

/* sanity check */
if (!rdev->desc->ops->is_enabled) {
ret = -EINVAL;
goto out;
}
if (!rdev->desc->ops->is_enabled)
return -EINVAL;

ret = rdev->desc->ops->is_enabled(rdev);
out:
mutex_unlock(&rdev->mutex);
return ret;
return rdev->desc->ops->is_enabled(rdev);
}

/**
Expand All @@ -1395,7 +1391,13 @@ static int _regulator_is_enabled(struct regulator_dev *rdev)
*/
int regulator_is_enabled(struct regulator *regulator)
{
return _regulator_is_enabled(regulator->rdev);
int ret;

mutex_lock(&regulator->rdev->mutex);
ret = _regulator_is_enabled(regulator->rdev);
mutex_unlock(&regulator->rdev->mutex);

return ret;
}
EXPORT_SYMBOL_GPL(regulator_is_enabled);

Expand Down

0 comments on commit 1282a21

Please sign in to comment.