mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
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>
This commit is contained in:
parent
7cd71c3ba1
commit
1768514eeb
1 changed files with 3 additions and 2 deletions
|
@ -1601,14 +1601,15 @@ static void _regulator_put(struct regulator *regulator)
|
||||||
if (regulator->dev)
|
if (regulator->dev)
|
||||||
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
|
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
|
||||||
mutex_lock(&rdev->mutex);
|
mutex_lock(&rdev->mutex);
|
||||||
kfree(regulator->supply_name);
|
|
||||||
list_del(®ulator->list);
|
list_del(®ulator->list);
|
||||||
kfree(regulator);
|
|
||||||
|
|
||||||
rdev->open_count--;
|
rdev->open_count--;
|
||||||
rdev->exclusive = 0;
|
rdev->exclusive = 0;
|
||||||
mutex_unlock(&rdev->mutex);
|
mutex_unlock(&rdev->mutex);
|
||||||
|
|
||||||
|
kfree(regulator->supply_name);
|
||||||
|
kfree(regulator);
|
||||||
|
|
||||||
module_put(rdev->owner);
|
module_put(rdev->owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue