aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMike Rapoport <mike@compulab.co.il>2009-01-22 09:00:29 -0500
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-03-31 04:56:23 -0400
commit0f1d747bfa89de4ca52dc1dffdcce35a2b8a1532 (patch)
treebb189d19d01af81a73a6966c257d7038477b0444 /drivers/regulator
parent90ca563b1030bece8a4f15a910e39a46f059ff48 (diff)
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>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0ed13c2a8c3c..b85e4a9dafcf 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,
831 } 831 }
832} 832}
833 833
834static void unset_regulator_supplies(struct regulator_dev *rdev)
835{
836 struct regulator_map *node, *n;
837
838 list_for_each_entry_safe(node, n, &regulator_map_list, list) {
839 if (rdev == node->regulator) {
840 list_del(&node->list);
841 kfree(node);
842 return;
843 }
844 }
845}
846
834#define REG_STR_SIZE 32 847#define REG_STR_SIZE 32
835 848
836static struct regulator *create_regulator(struct regulator_dev *rdev, 849static struct regulator *create_regulator(struct regulator_dev *rdev,
@@ -1970,6 +1983,7 @@ void regulator_unregister(struct regulator_dev *rdev)
1970 return; 1983 return;
1971 1984
1972 mutex_lock(&regulator_list_mutex); 1985 mutex_lock(&regulator_list_mutex);
1986 unset_regulator_supplies(rdev);
1973 list_del(&rdev->list); 1987 list_del(&rdev->list);
1974 if (rdev->supply) 1988 if (rdev->supply)
1975 sysfs_remove_link(&rdev->dev.kobj, "supply"); 1989 sysfs_remove_link(&rdev->dev.kobj, "supply");