From: Mattias Wallin Date: Thu, 4 Nov 2010 10:01:31 +0000 (+0100) Subject: regulator: lock supply in regulator enable X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63cee946148821bca42be10130b061c2d0f5af7e;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git regulator: lock supply in regulator enable This patch add locks around regulator supply enable. Signed-off-by: Mattias Wallin Acked-by: Mark Brown Signed-off-by: Liam Girdwood --- 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; } }