summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown2015-08-07 22:19:26 +0200
committerMark Brown2015-08-12 12:01:29 +0200
commit1768514eebfa888563049fa165449a1c1eba92d8 (patch)
treee9adcb41b282179be2783258d2cd96b61b600f2e /drivers/regulator
parentregulator: core: Drop regulator_list_mutex when we're done with it on remove (diff)
downloadkernel-qcow2-linux-1768514eebfa888563049fa165449a1c1eba92d8.tar.gz
kernel-qcow2-linux-1768514eebfa888563049fa165449a1c1eba92d8.tar.xz
kernel-qcow2-linux-1768514eebfa888563049fa165449a1c1eba92d8.zip
regulator: core: Reduce rdev locking region when releasing regulator
When we release a regulator we need to remove references to it from the rdev which means locking the rdev. Currently we also free resources associated with the regulator inside the rdev lock but there is no need to do this, we can reduce the region the lock is held by restricting it to just actions that affect the rdev. Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 62e4f3bd5783..89be8e287275 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1601,14 +1601,15 @@ static void _regulator_put(struct regulator *regulator)
if (regulator->dev)
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
mutex_lock(&rdev->mutex);
- kfree(regulator->supply_name);
list_del(&regulator->list);
- kfree(regulator);
rdev->open_count--;
rdev->exclusive = 0;
mutex_unlock(&rdev->mutex);
+ kfree(regulator->supply_name);
+ kfree(regulator);
+
module_put(rdev->owner);
}