diff options
author | Mattias Wallin <mattias.wallin@stericsson.com> | 2010-11-04 06:01:31 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-12 09:32:59 -0500 |
commit | 63cee946148821bca42be10130b061c2d0f5af7e (patch) | |
tree | 62e6df3e72d3ae2d7d3ea2aed89e0e14018b3bfe /drivers/regulator | |
parent | 4162cf64973df51fc885825bc9ca4d055891c49f (diff) |
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/regulator')
-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) | |||
1267 | { | 1267 | { |
1268 | int ret, delay; | 1268 | int ret, delay; |
1269 | 1269 | ||
1270 | if (rdev->use_count == 0) { | 1270 | /* do we need to enable the supply regulator first */ |
1271 | /* do we need to enable the supply regulator first */ | 1271 | if (rdev->supply) { |
1272 | if (rdev->supply) { | 1272 | mutex_lock(&rdev->supply->mutex); |
1273 | mutex_lock(&rdev->supply->mutex); | 1273 | ret = _regulator_enable(rdev->supply); |
1274 | ret = _regulator_enable(rdev->supply); | 1274 | mutex_unlock(&rdev->supply->mutex); |
1275 | mutex_unlock(&rdev->supply->mutex); | 1275 | if (ret < 0) { |
1276 | if (ret < 0) { | 1276 | printk(KERN_ERR "%s: failed to enable %s: %d\n", |
1277 | printk(KERN_ERR "%s: failed to enable %s: %d\n", | 1277 | __func__, rdev_get_name(rdev), ret); |
1278 | __func__, rdev_get_name(rdev), ret); | 1278 | return ret; |
1279 | return ret; | ||
1280 | } | ||
1281 | } | 1279 | } |
1282 | } | 1280 | } |
1283 | 1281 | ||