summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mfd-core.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-04-24 18:27:25 +0100
committerLee Jones <lee.jones@linaro.org>2014-06-03 08:11:18 +0100
commitd137be00ee017bc40e6027cb66d667a2e0b450fd (patch)
tree50ceb31fcd2babe58e41d7103d6fb86ecab67c39 /drivers/mfd/mfd-core.c
parent1ec93b9b176b3c4e065c326ccf40458fcc01e6c0 (diff)
downloadlinux-d137be00ee017bc40e6027cb66d667a2e0b450fd.tar.bz2
mfd: core: Don't use devres functions before device is added
The supply aliases for the MFD devices were being added using devres but the device hasn't been added at this point and as such we can't use devres. The MFD already has a function that removes devices this patch uses the non-devres versions of the supply alias functions and adds an unregister in mfd_remove_devices_fn. Reported-by: Carlo Caione <carlo@caione.org> Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/mfd-core.c')
-rw-r--r--drivers/mfd/mfd-core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 267649244737..892d343193ad 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -102,7 +102,7 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.dma_mask = parent->dma_mask;
pdev->dev.dma_parms = parent->dma_parms;
- ret = devm_regulator_bulk_register_supply_alias(
+ ret = regulator_bulk_register_supply_alias(
&pdev->dev, cell->parent_supplies,
parent, cell->parent_supplies,
cell->num_parent_supplies);
@@ -182,9 +182,9 @@ static int mfd_add_device(struct device *parent, int id,
return 0;
fail_alias:
- devm_regulator_bulk_unregister_supply_alias(&pdev->dev,
- cell->parent_supplies,
- cell->num_parent_supplies);
+ regulator_bulk_unregister_supply_alias(&pdev->dev,
+ cell->parent_supplies,
+ cell->num_parent_supplies);
fail_res:
kfree(res);
fail_device:
@@ -238,6 +238,9 @@ static int mfd_remove_devices_fn(struct device *dev, void *c)
pdev = to_platform_device(dev);
cell = mfd_get_cell(pdev);
+ regulator_bulk_unregister_supply_alias(dev, cell->parent_supplies,
+ cell->num_parent_supplies);
+
/* find the base address of usage_count pointers (for freeing) */
if (!*usage_count || (cell->usage_count < *usage_count))
*usage_count = cell->usage_count;