All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: core: Don't use devres functions before device is added
@ 2014-04-24 17:27 Charles Keepax
  2014-04-24 17:52 ` Mark Brown
  2014-04-28 10:26 ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Charles Keepax @ 2014-04-24 17:27 UTC (permalink / raw)
  To: lee.jones; +Cc: sameo, broonie, carlo, linux-kernel, patches

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>
---
 drivers/mfd/mfd-core.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 2676492..892d343 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;
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mfd: core: Don't use devres functions before device is added
  2014-04-24 17:27 [PATCH] mfd: core: Don't use devres functions before device is added Charles Keepax
@ 2014-04-24 17:52 ` Mark Brown
  2014-04-28 10:26 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-04-24 17:52 UTC (permalink / raw)
  To: Charles Keepax; +Cc: lee.jones, sameo, carlo, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

On Thu, Apr 24, 2014 at 06:27:25PM +0100, Charles Keepax wrote:
> 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.

Reviewed-by: Mark Brown <broonie@linaro.org>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mfd: core: Don't use devres functions before device is added
  2014-04-24 17:27 [PATCH] mfd: core: Don't use devres functions before device is added Charles Keepax
  2014-04-24 17:52 ` Mark Brown
@ 2014-04-28 10:26 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2014-04-28 10:26 UTC (permalink / raw)
  To: Charles Keepax; +Cc: sameo, broonie, carlo, linux-kernel, patches

> 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>
> ---
>  drivers/mfd/mfd-core.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-28 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 17:27 [PATCH] mfd: core: Don't use devres functions before device is added Charles Keepax
2014-04-24 17:52 ` Mark Brown
2014-04-28 10:26 ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.