mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-22 20:43:56 +08:00
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>
This commit is contained in:
parent
90ca563b10
commit
0f1d747bfa
@ -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, ®ulator_map_list, list) {
|
||||||
|
if (rdev == node->regulator) {
|
||||||
|
list_del(&node->list);
|
||||||
|
kfree(node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define REG_STR_SIZE 32
|
#define REG_STR_SIZE 32
|
||||||
|
|
||||||
static struct regulator *create_regulator(struct regulator_dev *rdev,
|
static struct regulator *create_regulator(struct regulator_dev *rdev,
|
||||||
@ -1970,6 +1983,7 @@ void regulator_unregister(struct regulator_dev *rdev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(®ulator_list_mutex);
|
mutex_lock(®ulator_list_mutex);
|
||||||
|
unset_regulator_supplies(rdev);
|
||||||
list_del(&rdev->list);
|
list_del(&rdev->list);
|
||||||
if (rdev->supply)
|
if (rdev->supply)
|
||||||
sysfs_remove_link(&rdev->dev.kobj, "supply");
|
sysfs_remove_link(&rdev->dev.kobj, "supply");
|
||||||
|
Loading…
Reference in New Issue
Block a user