public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] regulator: ab8500: use devm_regulator_register()
@ 2013-12-06  7:07 Jingoo Han
  2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:07 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Lee Jones', 'Bengt Jonsson', 'Axel Lin'

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/ab8500.c |   24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 0f86695..c625468 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3005,7 +3005,6 @@ static int ab8500_regulator_register(struct platform_device *pdev,
 	struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
 	struct ab8500_regulator_info *info = NULL;
 	struct regulator_config config = { };
-	int err;
 
 	/* assign per-regulator data */
 	info = &abx500_regulator.info[id];
@@ -3027,17 +3026,12 @@ static int ab8500_regulator_register(struct platform_device *pdev,
 	}
 
 	/* register regulator with framework */
-	info->regulator = regulator_register(&info->desc, &config);
+	info->regulator = devm_regulator_register(&pdev->dev, &info->desc,
+						&config);
 	if (IS_ERR(info->regulator)) {
-		err = PTR_ERR(info->regulator);
 		dev_err(&pdev->dev, "failed to register regulator %s\n",
 			info->desc.name);
-		/* when we fail, un-register all earlier regulators */
-		while (--id >= 0) {
-			info = &abx500_regulator.info[id];
-			regulator_unregister(info->regulator);
-		}
-		return err;
+		return PTR_ERR(info->regulator);
 	}
 
 	return 0;
@@ -3086,17 +3080,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
 
 static int ab8500_regulator_remove(struct platform_device *pdev)
 {
-	int i, err;
-
-	for (i = 0; i < abx500_regulator.info_size; i++) {
-		struct ab8500_regulator_info *info = NULL;
-		info = &abx500_regulator.info[i];
-
-		dev_vdbg(rdev_get_dev(info->regulator),
-			"%s-remove\n", info->desc.name);
-
-		regulator_unregister(info->regulator);
-	}
+	int err;
 
 	/* remove regulator debug */
 	err = ab8500_regulator_debug_exit(pdev);
-- 
1.7.10.4



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

* [PATCH 2/6] regulator: db8500-prcmu: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
@ 2013-12-06  7:08 ` Jingoo Han
  2013-12-06  8:35   ` Bengt Jönsson
  2013-12-09 17:41   ` Mark Brown
  2013-12-06  7:09 ` [PATCH 3/6] regulator: fixed: " Jingoo Han
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:08 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Bengt Jonsson'

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/db8500-prcmu.c |   20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index a53c11a..846acf2 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -431,17 +431,11 @@ static int db8500_regulator_register(struct platform_device *pdev,
 	config.of_node = np;
 
 	/* register with the regulator framework */
-	info->rdev = regulator_register(&info->desc, &config);
+	info->rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
 	if (IS_ERR(info->rdev)) {
 		err = PTR_ERR(info->rdev);
 		dev_err(&pdev->dev, "failed to register %s: err %i\n",
 			info->desc.name, err);
-
-		/* if failing, unregister all earlier regulators */
-		while (--id >= 0) {
-			info = &dbx500_regulator_info[id];
-			regulator_unregister(info->rdev);
-		}
 		return err;
 	}
 
@@ -530,20 +524,8 @@ static int db8500_regulator_probe(struct platform_device *pdev)
 
 static int db8500_regulator_remove(struct platform_device *pdev)
 {
-	int i;
-
 	ux500_regulator_debug_exit();
 
-	for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
-		struct dbx500_regulator_info *info;
-		info = &dbx500_regulator_info[i];
-
-		dev_vdbg(rdev_get_dev(info->rdev),
-			"regulator-%s-remove\n", info->desc.name);
-
-		regulator_unregister(info->rdev);
-	}
-
 	return 0;
 }
 
-- 
1.7.10.4



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

* [PATCH 3/6] regulator: fixed: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
  2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
@ 2013-12-06  7:09 ` Jingoo Han
  2013-12-09 17:44   ` Mark Brown
  2013-12-06  7:10 ` [PATCH 4/6] regulator: gpio-regulator: " Jingoo Han
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:09 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han'

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/fixed.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 5ea64b9..f45cc1ac 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
 	cfg.driver_data = drvdata;
 	cfg.of_node = pdev->dev.of_node;
 
-	drvdata->dev = regulator_register(&drvdata->desc, &cfg);
+	drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc,
+						&cfg);
 	if (IS_ERR(drvdata->dev)) {
 		ret = PTR_ERR(drvdata->dev);
 		dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
@@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct platform_device *pdev)
 {
 	struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
 
-	regulator_unregister(drvdata->dev);
 	kfree(drvdata->desc.supply_name);
 	kfree(drvdata->desc.name);
 
-- 
1.7.10.4



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

* [PATCH 4/6] regulator: gpio-regulator: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
  2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
  2013-12-06  7:09 ` [PATCH 3/6] regulator: fixed: " Jingoo Han
@ 2013-12-06  7:10 ` Jingoo Han
  2013-12-06  9:12   ` Heiko Stübner
  2013-12-06  7:11 ` [PATCH 5/6] regulator: pfuze100: " Jingoo Han
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:10 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Heiko Stuebner', 'Axel Lin'

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/gpio-regulator.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 13ec94d..fb4120b 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -324,7 +324,8 @@ static int gpio_regulator_probe(struct platform_device *pdev)
 			cfg.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
 	}
 
-	drvdata->dev = regulator_register(&drvdata->desc, &cfg);
+	drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc,
+						&cfg);
 	if (IS_ERR(drvdata->dev)) {
 		ret = PTR_ERR(drvdata->dev);
 		dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
@@ -351,8 +352,6 @@ static int gpio_regulator_remove(struct platform_device *pdev)
 {
 	struct gpio_regulator_data *drvdata = platform_get_drvdata(pdev);
 
-	regulator_unregister(drvdata->dev);
-
 	gpio_free_array(drvdata->gpios, drvdata->nr_gpios);
 
 	kfree(drvdata->states);
-- 
1.7.10.4



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

* [PATCH 5/6] regulator: pfuze100: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
                   ` (2 preceding siblings ...)
  2013-12-06  7:10 ` [PATCH 4/6] regulator: gpio-regulator: " Jingoo Han
@ 2013-12-06  7:11 ` Jingoo Han
  2013-12-09  2:36   ` yibin.gong
  2013-12-09 17:42   ` Mark Brown
  2013-12-06  7:12 ` [PATCH 6/6] regulator: stw481x-vmmc: " Jingoo Han
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:11 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Robin Gong', 'Axel Lin', 'Tim Harvey'

Use devm_regulator_register() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/pfuze100-regulator.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
index 032df37..50c1bf8 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -408,31 +408,18 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
 		config.driver_data = pfuze_chip;
 		config.of_node = match_of_node(i);
 
-		pfuze_chip->regulators[i] = regulator_register(desc, &config);
+		pfuze_chip->regulators[i] =
+			devm_regulator_register(&client->dev, desc, &config);
 		if (IS_ERR(pfuze_chip->regulators[i])) {
 			dev_err(&client->dev, "register regulator%s failed\n",
 				pfuze100_regulators[i].desc.name);
-			ret = PTR_ERR(pfuze_chip->regulators[i]);
-			while (--i >= 0)
-				regulator_unregister(pfuze_chip->regulators[i]);
-			return ret;
+			return PTR_ERR(pfuze_chip->regulators[i]);
 		}
 	}
 
 	return 0;
 }
 
-static int pfuze100_regulator_remove(struct i2c_client *client)
-{
-	int i;
-	struct pfuze_chip *pfuze_chip = i2c_get_clientdata(client);
-
-	for (i = 0; i < PFUZE100_MAX_REGULATOR; i++)
-		regulator_unregister(pfuze_chip->regulators[i]);
-
-	return 0;
-}
-
 static struct i2c_driver pfuze_driver = {
 	.id_table = pfuze_device_id,
 	.driver = {
@@ -441,7 +428,6 @@ static struct i2c_driver pfuze_driver = {
 		.of_match_table = pfuze_dt_ids,
 	},
 	.probe = pfuze100_regulator_probe,
-	.remove = pfuze100_regulator_remove,
 };
 module_i2c_driver(pfuze_driver);
 
-- 
1.7.10.4



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

* [PATCH 6/6] regulator: stw481x-vmmc: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
                   ` (3 preceding siblings ...)
  2013-12-06  7:11 ` [PATCH 5/6] regulator: pfuze100: " Jingoo Han
@ 2013-12-06  7:12 ` Jingoo Han
  2013-12-09  8:33   ` Linus Walleij
  2013-12-09 17:26   ` Mark Brown
  2013-12-06  8:26 ` [PATCH 1/6] regulator: ab8500: " Lee Jones
  2013-12-09 17:38 ` Mark Brown
  6 siblings, 2 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-06  7:12 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Linus Walleij'

Use devm_regulator_register() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/stw481x-vmmc.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/stw481x-vmmc.c b/drivers/regulator/stw481x-vmmc.c
index f78857b..a7e1526 100644
--- a/drivers/regulator/stw481x-vmmc.c
+++ b/drivers/regulator/stw481x-vmmc.c
@@ -74,7 +74,8 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev)
 	config.init_data = of_get_regulator_init_data(&pdev->dev,
 						      pdev->dev.of_node);
 
-	stw481x->vmmc_regulator = regulator_register(&vmmc_regulator, &config);
+	stw481x->vmmc_regulator = devm_regulator_register(&pdev->dev,
+						&vmmc_regulator, &config);
 	if (IS_ERR(stw481x->vmmc_regulator)) {
 		dev_err(&pdev->dev,
 			"error initializing STw481x VMMC regulator\n");
@@ -85,14 +86,6 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int stw481x_vmmc_regulator_remove(struct platform_device *pdev)
-{
-	struct stw481x *stw481x = dev_get_platdata(&pdev->dev);
-
-	regulator_unregister(stw481x->vmmc_regulator);
-	return 0;
-}
-
 static const struct of_device_id stw481x_vmmc_match[] = {
 	{ .compatible = "st,stw481x-vmmc", },
 	{},
@@ -105,7 +98,6 @@ static struct platform_driver stw481x_vmmc_regulator_driver = {
 		.of_match_table = stw481x_vmmc_match,
 	},
 	.probe = stw481x_vmmc_regulator_probe,
-	.remove = stw481x_vmmc_regulator_remove,
 };
 
 module_platform_driver(stw481x_vmmc_regulator_driver);
-- 
1.7.10.4



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

* Re: [PATCH 1/6] regulator: ab8500: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
                   ` (4 preceding siblings ...)
  2013-12-06  7:12 ` [PATCH 6/6] regulator: stw481x-vmmc: " Jingoo Han
@ 2013-12-06  8:26 ` Lee Jones
  2013-12-09 17:38 ` Mark Brown
  6 siblings, 0 replies; 19+ messages in thread
From: Lee Jones @ 2013-12-06  8:26 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Mark Brown', 'Liam Girdwood', linux-kernel,
	'Bengt Jonsson', 'Axel Lin'

On Fri, 06 Dec 2013, Jingoo Han wrote:

> Use devm_regulator_register() to make cleanup paths simpler.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/regulator/ab8500.c |   24 ++++--------------------
>  1 file changed, 4 insertions(+), 20 deletions(-)

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
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] 19+ messages in thread

* RE: [PATCH 2/6] regulator: db8500-prcmu: use devm_regulator_register()
  2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
@ 2013-12-06  8:35   ` Bengt Jönsson
  2013-12-09 17:41   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: Bengt Jönsson @ 2013-12-06  8:35 UTC (permalink / raw)
  To: Jingoo Han, 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel@vger.kernel.org,
	'Bengt Jonsson'

-----Original Message-----
From: Jingoo Han [mailto:jg1.han@samsung.com] 
Sent: den 6 december 2013 08:09
To: 'Mark Brown'
Cc: 'Liam Girdwood'; linux-kernel@vger.kernel.org; 'Jingoo Han'; 'Bengt Jonsson'
Subject: [PATCH 2/6] regulator: db8500-prcmu: use devm_regulator_register()

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>

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

* Re: [PATCH 4/6] regulator: gpio-regulator: use devm_regulator_register()
  2013-12-06  7:10 ` [PATCH 4/6] regulator: gpio-regulator: " Jingoo Han
@ 2013-12-06  9:12   ` Heiko Stübner
  2013-12-06 12:09     ` Mark Brown
  0 siblings, 1 reply; 19+ messages in thread
From: Heiko Stübner @ 2013-12-06  9:12 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Mark Brown', 'Liam Girdwood', linux-kernel,
	'Axel Lin'

Hi,

Am Freitag, 6. Dezember 2013, 08:10:42 schrieb Jingoo Han:

> @@ -351,8 +352,6 @@ static int gpio_regulator_remove(struct platform_device
> *pdev) {
>  	struct gpio_regulator_data *drvdata = platform_get_drvdata(pdev);
> 
> -	regulator_unregister(drvdata->dev);
> -
>  	gpio_free_array(drvdata->gpios, drvdata->nr_gpios);
> 
>  	kfree(drvdata->states);

I'm not this firm in the core driver/device behaviour, but when looking at 
__device_release_driver I see that the remove callback runs before 
devres_release_all, which would effectively free the gpios before the 
regulator gets unregistered - is this racy with a regulator change at the same 
time?


Heiko

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

* Re: [PATCH 4/6] regulator: gpio-regulator: use devm_regulator_register()
  2013-12-06  9:12   ` Heiko Stübner
@ 2013-12-06 12:09     ` Mark Brown
  2013-12-09  2:01       ` Jingoo Han
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-12-06 12:09 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Jingoo Han, 'Liam Girdwood', linux-kernel,
	'Axel Lin'

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

On Fri, Dec 06, 2013 at 10:12:05AM +0100, Heiko Stübner wrote:

> I'm not this firm in the core driver/device behaviour, but when looking at 
> __device_release_driver I see that the remove callback runs before 
> devres_release_all, which would effectively free the gpios before the 
> regulator gets unregistered - is this racy with a regulator change at the same 
> time?

Yes, the rest of the driver really needs to be converted to devm_ at the
same time.

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

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

* Re: [PATCH 4/6] regulator: gpio-regulator: use devm_regulator_register()
  2013-12-06 12:09     ` Mark Brown
@ 2013-12-09  2:01       ` Jingoo Han
  0 siblings, 0 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-09  2:01 UTC (permalink / raw)
  To: 'Mark Brown', 'Heiko Stübner'
  Cc: 'Liam Girdwood', linux-kernel, 'Axel Lin',
	'Jingoo Han'

On Friday, December 06, 2013 9:09 PM, Mark Brown wrote:
> On Fri, Dec 06, 2013 at 10:12:05AM +0100, Heiko Stübner wrote:
> 
> > I'm not this firm in the core driver/device behaviour, but when looking at
> > __device_release_driver I see that the remove callback runs before
> > devres_release_all, which would effectively free the gpios before the
> > regulator gets unregistered - is this racy with a regulator change at the same
> > time?
> 
> Yes, the rest of the driver really needs to be converted to devm_ at the
> same time.

The gpios is requested by gpio_request_array().
However, devm_gpio_request_array() is not supported yet,
so the rest of the driver cannot be converted to devm_.

Mark Brown,
Please ignore this patch.

Best regards,
Jingoo Han


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

* RE: [PATCH 5/6] regulator: pfuze100: use devm_regulator_register()
  2013-12-06  7:11 ` [PATCH 5/6] regulator: pfuze100: " Jingoo Han
@ 2013-12-09  2:36   ` yibin.gong
  2013-12-09 17:42   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: yibin.gong @ 2013-12-09  2:36 UTC (permalink / raw)
  To: Jingoo Han, 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel@vger.kernel.org,
	yibin.gong@freescale.com, 'Axel Lin',
	'Tim Harvey'

Acked-by: Robin Gong <b38343@freescale.com>
	
-----Original Message-----
From: Jingoo Han [mailto:jg1.han@samsung.com] 
Sent: Friday, December 06, 2013 3:12 PM
To: 'Mark Brown'
Cc: 'Liam Girdwood'; linux-kernel@vger.kernel.org; 'Jingoo Han'; Gong Yibin-B38343; 'Axel Lin'; 'Tim Harvey'
Subject: [PATCH 5/6] regulator: pfuze100: use devm_regulator_register()

Use devm_regulator_register() to make cleanup paths simpler, and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/pfuze100-regulator.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c
index 032df37..50c1bf8 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -408,31 +408,18 @@ static int pfuze100_regulator_probe(struct i2c_client *client,
 		config.driver_data = pfuze_chip;
 		config.of_node = match_of_node(i);
 
-		pfuze_chip->regulators[i] = regulator_register(desc, &config);
+		pfuze_chip->regulators[i] =
+			devm_regulator_register(&client->dev, desc, &config);
 		if (IS_ERR(pfuze_chip->regulators[i])) {
 			dev_err(&client->dev, "register regulator%s failed\n",
 				pfuze100_regulators[i].desc.name);
-			ret = PTR_ERR(pfuze_chip->regulators[i]);
-			while (--i >= 0)
-				regulator_unregister(pfuze_chip->regulators[i]);
-			return ret;
+			return PTR_ERR(pfuze_chip->regulators[i]);
 		}
 	}
 
 	return 0;
 }
 
-static int pfuze100_regulator_remove(struct i2c_client *client) -{
-	int i;
-	struct pfuze_chip *pfuze_chip = i2c_get_clientdata(client);
-
-	for (i = 0; i < PFUZE100_MAX_REGULATOR; i++)
-		regulator_unregister(pfuze_chip->regulators[i]);
-
-	return 0;
-}
-
 static struct i2c_driver pfuze_driver = {
 	.id_table = pfuze_device_id,
 	.driver = {
@@ -441,7 +428,6 @@ static struct i2c_driver pfuze_driver = {
 		.of_match_table = pfuze_dt_ids,
 	},
 	.probe = pfuze100_regulator_probe,
-	.remove = pfuze100_regulator_remove,
 };
 module_i2c_driver(pfuze_driver);
 
--
1.7.10.4




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

* Re: [PATCH 6/6] regulator: stw481x-vmmc: use devm_regulator_register()
  2013-12-06  7:12 ` [PATCH 6/6] regulator: stw481x-vmmc: " Jingoo Han
@ 2013-12-09  8:33   ` Linus Walleij
  2013-12-09 17:26   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2013-12-09  8:33 UTC (permalink / raw)
  To: Jingoo Han; +Cc: Mark Brown, Liam Girdwood, linux-kernel@vger.kernel.org

On Fri, Dec 6, 2013 at 8:12 AM, Jingoo Han <jg1.han@samsung.com> wrote:

> Use devm_regulator_register() to make cleanup paths simpler,
> and remove unnecessary remove().
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 6/6] regulator: stw481x-vmmc: use devm_regulator_register()
  2013-12-06  7:12 ` [PATCH 6/6] regulator: stw481x-vmmc: " Jingoo Han
  2013-12-09  8:33   ` Linus Walleij
@ 2013-12-09 17:26   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: Mark Brown @ 2013-12-09 17:26 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Liam Girdwood', linux-kernel, 'Linus Walleij'

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

On Fri, Dec 06, 2013 at 04:12:41PM +0900, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler,
> and remove unnecessary remove().

Applied, thanks.

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

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

* Re: [PATCH 1/6] regulator: ab8500: use devm_regulator_register()
  2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
                   ` (5 preceding siblings ...)
  2013-12-06  8:26 ` [PATCH 1/6] regulator: ab8500: " Lee Jones
@ 2013-12-09 17:38 ` Mark Brown
  6 siblings, 0 replies; 19+ messages in thread
From: Mark Brown @ 2013-12-09 17:38 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Liam Girdwood', linux-kernel, 'Lee Jones',
	'Bengt Jonsson', 'Axel Lin'

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

On Fri, Dec 06, 2013 at 04:07:09PM +0900, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler.

Applied, thanks.

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

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

* Re: [PATCH 2/6] regulator: db8500-prcmu: use devm_regulator_register()
  2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
  2013-12-06  8:35   ` Bengt Jönsson
@ 2013-12-09 17:41   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: Mark Brown @ 2013-12-09 17:41 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Liam Girdwood', linux-kernel, 'Bengt Jonsson'

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

On Fri, Dec 06, 2013 at 04:08:38PM +0900, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler.

Applied, thanks.

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

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

* Re: [PATCH 5/6] regulator: pfuze100: use devm_regulator_register()
  2013-12-06  7:11 ` [PATCH 5/6] regulator: pfuze100: " Jingoo Han
  2013-12-09  2:36   ` yibin.gong
@ 2013-12-09 17:42   ` Mark Brown
  1 sibling, 0 replies; 19+ messages in thread
From: Mark Brown @ 2013-12-09 17:42 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Liam Girdwood', linux-kernel, 'Robin Gong',
	'Axel Lin', 'Tim Harvey'

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

On Fri, Dec 06, 2013 at 04:11:58PM +0900, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler,
> and remove unnecessary remove().

Applied, thanks.

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

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

* Re: [PATCH 3/6] regulator: fixed: use devm_regulator_register()
  2013-12-06  7:09 ` [PATCH 3/6] regulator: fixed: " Jingoo Han
@ 2013-12-09 17:44   ` Mark Brown
  2013-12-10  6:08     ` Jingoo Han
  0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2013-12-09 17:44 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Liam Girdwood', linux-kernel

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

On Fri, Dec 06, 2013 at 04:09:29PM +0900, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler.

This has the same issue as the gpio regulator - it needs a more complete
conversion to devm to be safe due to the use of other resources by the
regulator while it's running.  The conversion looks straightfoward
though.

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

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

* Re: [PATCH 3/6] regulator: fixed: use devm_regulator_register()
  2013-12-09 17:44   ` Mark Brown
@ 2013-12-10  6:08     ` Jingoo Han
  0 siblings, 0 replies; 19+ messages in thread
From: Jingoo Han @ 2013-12-10  6:08 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han'

On Tuesday, December 10, 2013 2:45 AM, Mark Brown wrote:
> On Fri, Dec 06, 2013 at 04:09:29PM +0900, Jingoo Han wrote:
> > Use devm_regulator_register() to make cleanup paths simpler.
> 
> This has the same issue as the gpio regulator - it needs a more complete
> conversion to devm to be safe due to the use of other resources by the
> regulator while it's running.  The conversion looks straightfoward
> though.

OK, I see.
Please ignore this patch.
Thank you for your comment.

Best regards,
Jingoo Han


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

end of thread, other threads:[~2013-12-10  6:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
2013-12-06  7:08 ` [PATCH 2/6] regulator: db8500-prcmu: " Jingoo Han
2013-12-06  8:35   ` Bengt Jönsson
2013-12-09 17:41   ` Mark Brown
2013-12-06  7:09 ` [PATCH 3/6] regulator: fixed: " Jingoo Han
2013-12-09 17:44   ` Mark Brown
2013-12-10  6:08     ` Jingoo Han
2013-12-06  7:10 ` [PATCH 4/6] regulator: gpio-regulator: " Jingoo Han
2013-12-06  9:12   ` Heiko Stübner
2013-12-06 12:09     ` Mark Brown
2013-12-09  2:01       ` Jingoo Han
2013-12-06  7:11 ` [PATCH 5/6] regulator: pfuze100: " Jingoo Han
2013-12-09  2:36   ` yibin.gong
2013-12-09 17:42   ` Mark Brown
2013-12-06  7:12 ` [PATCH 6/6] regulator: stw481x-vmmc: " Jingoo Han
2013-12-09  8:33   ` Linus Walleij
2013-12-09 17:26   ` Mark Brown
2013-12-06  8:26 ` [PATCH 1/6] regulator: ab8500: " Lee Jones
2013-12-09 17:38 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox