regulator: add unset_regulator_supplies to fix regulator_unregister

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, April 3, 2009 - 11:11 am

Gitweb:     http://git.kernel.org/linus/0f1d747bfa89de4ca52dc1dffdcce35a2b8a1532
Commit:     0f1d747bfa89de4ca52dc1dffdcce35a2b8a1532
Parent:     90ca563b1030bece8a4f15a910e39a46f059ff48
Author:     Mike Rapoport <mike@compulab.co.il>
AuthorDate: Thu Jan 22 16:00:29 2009 +0200
Committer:  Liam Girdwood <lrg@slimlogic.co.uk>
CommitDate: Tue Mar 31 09:56:23 2009 +0100

    regulator: add unset_regulator_supplies to fix regulator_unregister
    
    Currently regulator_unregister does not clear regulator <--> consumer
    mapping.
    This patch introduces unset_regulator_supplies that clear the map.
    
    Signed-off-by: Mike Rapoport <mike@compulab.co.il>
    Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
---
 drivers/regulator/core.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0ed13c2..b85e4a9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -831,6 +831,19 @@ static void unset_consumer_device_supply(struct regulator_dev *rdev,
 	}
 }
 
+static void unset_regulator_supplies(struct regulator_dev *rdev)
+{
+	struct regulator_map *node, *n;
+
+	list_for_each_entry_safe(node, n, &regulator_map_list, list) {
+		if (rdev == node->regulator) {
+			list_del(&node->list);
+			kfree(node);
+			return;
+		}
+	}
+}
+
 #define REG_STR_SIZE	32
 
 static struct regulator *create_regulator(struct regulator_dev *rdev,
@@ -1970,6 +1983,7 @@ void regulator_unregister(struct regulator_dev *rdev)
 		return;
 
 	mutex_lock(&regulator_list_mutex);
+	unset_regulator_supplies(rdev);
 	list_del(&rdev->list);
 	if (rdev->supply)
 		sysfs_remove_link(&rdev->dev.kobj, "supply");
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
regulator: add unset_regulator_supplies to fix regulator_u ..., Linux Kernel Mailing ..., (Fri Apr 3, 11:11 am)