mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] regulator: core: Reduce rdev locking region when releasing regulator
@ 2015-08-12 12:20 Mark Brown
  2015-08-12 12:20 ` [PATCH 2/3] regulator: core: Move more deallocation into class unregister Mark Brown
  2015-08-12 12:20 ` [PATCH 3/3] regulator: core: Use class device list for regulator_list in late init Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Brown @ 2015-08-12 12:20 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: linux-kernel, Mark Brown

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>
---
 drivers/regulator/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 62e4f3b..89be8e2 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);
 }
 
-- 
2.5.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-12 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-12 12:20 [PATCH 1/3] regulator: core: Reduce rdev locking region when releasing regulator Mark Brown
2015-08-12 12:20 ` [PATCH 2/3] regulator: core: Move more deallocation into class unregister Mark Brown
2015-08-12 12:20 ` [PATCH 3/3] regulator: core: Use class device list for regulator_list in late init Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®