Commit d137be00 authored by Charles Keepax's avatar Charles Keepax Committed by Lee Jones

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: default avatarCarlo Caione <carlo@caione.org>
Reported-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 1ec93b9b
...@@ -102,7 +102,7 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -102,7 +102,7 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.dma_mask = parent->dma_mask; pdev->dev.dma_mask = parent->dma_mask;
pdev->dev.dma_parms = parent->dma_parms; 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, &pdev->dev, cell->parent_supplies,
parent, cell->parent_supplies, parent, cell->parent_supplies,
cell->num_parent_supplies); cell->num_parent_supplies);
...@@ -182,9 +182,9 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -182,9 +182,9 @@ static int mfd_add_device(struct device *parent, int id,
return 0; return 0;
fail_alias: fail_alias:
devm_regulator_bulk_unregister_supply_alias(&pdev->dev, regulator_bulk_unregister_supply_alias(&pdev->dev,
cell->parent_supplies, cell->parent_supplies,
cell->num_parent_supplies); cell->num_parent_supplies);
fail_res: fail_res:
kfree(res); kfree(res);
fail_device: fail_device:
...@@ -238,6 +238,9 @@ static int mfd_remove_devices_fn(struct device *dev, void *c) ...@@ -238,6 +238,9 @@ static int mfd_remove_devices_fn(struct device *dev, void *c)
pdev = to_platform_device(dev); pdev = to_platform_device(dev);
cell = mfd_get_cell(pdev); 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) */ /* find the base address of usage_count pointers (for freeing) */
if (!*usage_count || (cell->usage_count < *usage_count)) if (!*usage_count || (cell->usage_count < *usage_count))
*usage_count = cell->usage_count; *usage_count = cell->usage_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment