diff options
author | Mattias Wallin <mattias.wallin@stericsson.com> | 2010-11-04 11:01:31 +0100 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-12 15:32:59 +0100 |
commit | 63cee946148821bca42be10130b061c2d0f5af7e (patch) | |
tree | 62e6df3e72d3ae2d7d3ea2aed89e0e14018b3bfe /drivers | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 (diff) | |
download | linux-63cee946148821bca42be10130b061c2d0f5af7e.tar.xz linux-63cee946148821bca42be10130b061c2d0f5af7e.zip |
regulator: lock supply in regulator enable
This patch add locks around regulator supply enable.
Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/core.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index ba521f0f0fac..81336e23848a 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1267,17 +1267,15 @@ static int _regulator_enable(struct regulator_dev *rdev) { int ret, delay; - if (rdev->use_count == 0) { - /* do we need to enable the supply regulator first */ - if (rdev->supply) { - mutex_lock(&rdev->supply->mutex); - ret = _regulator_enable(rdev->supply); - mutex_unlock(&rdev->supply->mutex); - if (ret < 0) { - printk(KERN_ERR "%s: failed to enable %s: %d\n", - __func__, rdev_get_name(rdev), ret); - return ret; - } + /* do we need to enable the supply regulator first */ + if (rdev->supply) { + mutex_lock(&rdev->supply->mutex); + ret = _regulator_enable(rdev->supply); + mutex_unlock(&rdev->supply->mutex); + if (ret < 0) { + printk(KERN_ERR "%s: failed to enable %s: %d\n", + __func__, rdev_get_name(rdev), ret); + return ret; } } |