All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/20] regulator: ab3100: use devm_regulator_register()
@ 2013-09-25  7:48 Jingoo Han
  2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
                   ` (19 more replies)
  0 siblings, 20 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:48 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Linus Walleij'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 7d5eaa8..77b46d0 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -535,7 +535,7 @@ static int ab3100_regulator_register(struct platform_device *pdev,
 	config.dev = &pdev->dev;
 	config.driver_data = reg;
 
-	rdev = regulator_register(desc, &config);
+	rdev = devm_regulator_register(&pdev->dev, desc, &config);
 	if (IS_ERR(rdev)) {
 		err = PTR_ERR(rdev);
 		dev_err(&pdev->dev,
@@ -616,7 +616,6 @@ static int ab3100_regulators_remove(struct platform_device *pdev)
 	for (i = 0; i < AB3100_NUM_REGULATORS; i++) {
 		struct ab3100_regulator *reg = &ab3100_regulators[i];
 
-		regulator_unregister(reg->rdev);
 		reg->rdev = NULL;
 	}
 	return 0;
-- 
1.7.10.4



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

* [PATCH 02/20] regulator: ab8500: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
@ 2013-09-25  7:51 ` Jingoo Han
  2013-09-25 10:20   ` Sachin Kamat
  2013-09-25  7:52 ` [PATCH 03/20] regulator: ab8500-ext: " Jingoo Han
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:51 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/ab8500.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 603f192..a4a4a42 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3058,16 +3058,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;
 	}
 
@@ -3172,17 +3168,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] 28+ messages in thread

* [PATCH 03/20] regulator: ab8500-ext: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
  2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
@ 2013-09-25  7:52 ` Jingoo Han
  2013-09-25  7:55 ` [PATCH 04/20] regulator: da9063: " Jingoo Han
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:52 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Bengt Jonsson'

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

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

diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index 02ff691..29c0faa 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -413,16 +413,12 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
 			&pdata->ext_regulator[i];
 
 		/* register regulator with 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 regulator %s\n",
 					info->desc.name);
-			/* when we fail, un-register all earlier regulators */
-			while (--i >= 0) {
-				info = &ab8500_ext_regulator_info[i];
-				regulator_unregister(info->rdev);
-			}
 			return err;
 		}
 
@@ -433,26 +429,8 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int ab8500_ext_regulator_remove(struct platform_device *pdev)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) {
-		struct ab8500_ext_regulator_info *info = NULL;
-		info = &ab8500_ext_regulator_info[i];
-
-		dev_vdbg(rdev_get_dev(info->rdev),
-			"%s-remove\n", info->desc.name);
-
-		regulator_unregister(info->rdev);
-	}
-
-	return 0;
-}
-
 static struct platform_driver ab8500_ext_regulator_driver = {
 	.probe = ab8500_ext_regulator_probe,
-	.remove = ab8500_ext_regulator_remove,
 	.driver         = {
 		.name   = "ab8500-ext-regulator",
 		.owner  = THIS_MODULE,
-- 
1.7.10.4



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

* [PATCH 04/20] regulator: da9063: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
  2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
  2013-09-25  7:52 ` [PATCH 03/20] regulator: ab8500-ext: " Jingoo Han
@ 2013-09-25  7:55 ` Jingoo Han
  2013-09-25  7:56 ` [PATCH 05/20] regulator: da9210: " Jingoo Han
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:55 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Geert Uytterhoeven', 'Krystian Garbaciak'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 3d910f4..56727eb 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 		if (da9063_reg_matches)
 			config.of_node = da9063_reg_matches[id].of_node;
 		config.regmap = da9063->regmap;
-		regl->rdev = regulator_register(&regl->desc, &config);
+		regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
+						     &config);
 		if (IS_ERR(regl->rdev)) {
 			dev_err(&pdev->dev,
 				"Failed to register %s regulator\n",
 				regl->desc.name);
-			ret = PTR_ERR(regl->rdev);
-			goto err;
+			return PTR_ERR(regl->rdev);
 		}
 		id++;
 		n++;
@@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 	/* LDOs overcurrent event support */
 	irq = platform_get_irq_byname(pdev, "LDO_LIM");
 	if (irq < 0) {
-		ret = irq;
 		dev_err(&pdev->dev, "Failed to get IRQ.\n");
-		goto err;
+		return irq;
 	}
 
 	regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq);
@@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev)
 	}
 
 	return 0;
-
-err:
-	/* Wind back regulators registeration */
-	while (--n >= 0)
-		regulator_unregister(regulators->regulator[n].rdev);
-
-	return ret;
 }
 
 static int da9063_regulator_remove(struct platform_device *pdev)
 {
 	struct da9063_regulators *regulators = platform_get_drvdata(pdev);
-	struct da9063_regulator *regl;
 
 	free_irq(regulators->irq_ldo_lim, regulators);
 	free_irq(regulators->irq_uvov, regulators);
 
-	for (regl = &regulators->regulator[regulators->n_regulators - 1];
-	     regl >= &regulators->regulator[0]; regl--)
-		regulator_unregister(regl->rdev);
-
 	return 0;
 }
 
-- 
1.7.10.4



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

* [PATCH 05/20] regulator: da9210: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (2 preceding siblings ...)
  2013-09-25  7:55 ` [PATCH 04/20] regulator: da9063: " Jingoo Han
@ 2013-09-25  7:56 ` Jingoo Han
  2013-09-25  7:58 ` [PATCH 06/20] regulator: fixed: " Jingoo Han
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:56 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Steve Twiss', 'David Dajun Chen'

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

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

diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c
index f0fe54b..82368a3 100644
--- a/drivers/regulator/da9210-regulator.c
+++ b/drivers/regulator/da9210-regulator.c
@@ -152,7 +152,7 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
 	config.driver_data = chip;
 	config.regmap = chip->regmap;
 
-	rdev = regulator_register(&da9210_reg, &config);
+	rdev = devm_regulator_register(&i2c->dev, &da9210_reg, &config);
 	if (IS_ERR(rdev)) {
 		dev_err(&i2c->dev, "Failed to register DA9210 regulator\n");
 		return PTR_ERR(rdev);
@@ -165,13 +165,6 @@ static int da9210_i2c_probe(struct i2c_client *i2c,
 	return 0;
 }
 
-static int da9210_i2c_remove(struct i2c_client *i2c)
-{
-	struct da9210 *chip = i2c_get_clientdata(i2c);
-	regulator_unregister(chip->rdev);
-	return 0;
-}
-
 static const struct i2c_device_id da9210_i2c_id[] = {
 	{"da9210", 0},
 	{},
@@ -185,7 +178,6 @@ static struct i2c_driver da9210_regulator_driver = {
 		.owner = THIS_MODULE,
 	},
 	.probe = da9210_i2c_probe,
-	.remove = da9210_i2c_remove,
 	.id_table = da9210_i2c_id,
 };
 
-- 
1.7.10.4



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

* [PATCH 06/20] regulator: fixed: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (3 preceding siblings ...)
  2013-09-25  7:56 ` [PATCH 05/20] regulator: da9210: " Jingoo Han
@ 2013-09-25  7:58 ` Jingoo Han
  2013-09-25  8:00 ` [PATCH 07/20] regulator: gpio-regulator: " Jingoo Han
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  7:58 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 de811f3..5dadcad 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -188,7 +188,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);
@@ -214,7 +215,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] 28+ messages in thread

* [PATCH 07/20] regulator: gpio-regulator: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (4 preceding siblings ...)
  2013-09-25  7:58 ` [PATCH 06/20] regulator: fixed: " Jingoo Han
@ 2013-09-25  8:00 ` Jingoo Han
  2013-09-25  8:01 ` [PATCH 08/20] regulator: lp3971: " Jingoo Han
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:00 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 98a98ff..92aaec6 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -322,7 +322,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);
@@ -349,8 +350,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] 28+ messages in thread

* [PATCH 08/20] regulator: lp3971: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (5 preceding siblings ...)
  2013-09-25  8:00 ` [PATCH 07/20] regulator: gpio-regulator: " Jingoo Han
@ 2013-09-25  8:01 ` Jingoo Han
  2013-09-25  8:02 ` [PATCH 09/20] regulator: lp3972: " Jingoo Han
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:01 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Marek Szyprowski'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 5a4604e..97452a2 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -400,8 +400,9 @@ static int setup_regulators(struct lp3971 *lp3971,
 		config.init_data = reg->initdata;
 		config.driver_data = lp3971;
 
-		lp3971->rdev[i] = regulator_register(&regulators[reg->id],
-						     &config);
+		lp3971->rdev[i] = devm_regulator_register(lp3971->dev,
+							  &regulators[reg->id],
+							  &config);
 		if (IS_ERR(lp3971->rdev[i])) {
 			err = PTR_ERR(lp3971->rdev[i]);
 			dev_err(lp3971->dev, "regulator init failed: %d\n",
@@ -413,8 +414,6 @@ static int setup_regulators(struct lp3971 *lp3971,
 	return 0;
 
 error:
-	while (--i >= 0)
-		regulator_unregister(lp3971->rdev[i]);
 	kfree(lp3971->rdev);
 	lp3971->rdev = NULL;
 err_nomem:
@@ -463,10 +462,6 @@ static int lp3971_i2c_probe(struct i2c_client *i2c,
 static int lp3971_i2c_remove(struct i2c_client *i2c)
 {
 	struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
-	int i;
-
-	for (i = 0; i < lp3971->num_regulators; i++)
-		regulator_unregister(lp3971->rdev[i]);
 
 	kfree(lp3971->rdev);
 
-- 
1.7.10.4



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

* [PATCH 09/20] regulator: lp3972: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (6 preceding siblings ...)
  2013-09-25  8:01 ` [PATCH 08/20] regulator: lp3971: " Jingoo Han
@ 2013-09-25  8:02 ` Jingoo Han
  2013-09-25 10:17   ` Sachin Kamat
  2013-09-25  8:03 ` [PATCH 10/20] regulator: lp872x: " Jingoo Han
                   ` (11 subsequent siblings)
  19 siblings, 1 reply; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:02 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Marek Szyprowski'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c
index 093e6f4..3c18042 100644
--- a/drivers/regulator/lp3972.c
+++ b/drivers/regulator/lp3972.c
@@ -495,8 +495,9 @@ static int setup_regulators(struct lp3972 *lp3972,
 		config.init_data = reg->initdata;
 		config.driver_data = lp3972;
 
-		lp3972->rdev[i] = regulator_register(&regulators[reg->id],
-						     &config);
+		lp3972->rdev[i] = devm_regulator_register(lp3972->dev,
+							  &regulators[reg->id],
+							  &config);
 		if (IS_ERR(lp3972->rdev[i])) {
 			err = PTR_ERR(lp3972->rdev[i]);
 			dev_err(lp3972->dev, "regulator init failed: %d\n",
@@ -507,8 +508,6 @@ static int setup_regulators(struct lp3972 *lp3972,
 
 	return 0;
 error:
-	while (--i >= 0)
-		regulator_unregister(lp3972->rdev[i]);
 	kfree(lp3972->rdev);
 	lp3972->rdev = NULL;
 err_nomem:
@@ -560,10 +559,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c,
 static int lp3972_i2c_remove(struct i2c_client *i2c)
 {
 	struct lp3972 *lp3972 = i2c_get_clientdata(i2c);
-	int i;
 
-	for (i = 0; i < lp3972->num_regulators; i++)
-		regulator_unregister(lp3972->rdev[i]);
 	kfree(lp3972->rdev);
 
 	return 0;
-- 
1.7.10.4



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

* [PATCH 10/20] regulator: lp872x: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (7 preceding siblings ...)
  2013-09-25  8:02 ` [PATCH 09/20] regulator: lp3972: " Jingoo Han
@ 2013-09-25  8:03 ` Jingoo Han
  2013-09-25  8:04 ` [PATCH 11/20] regulator: lp8788-buck: " Jingoo Han
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:03 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Milo Kim'

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

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

diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 2b84b72..2e4734f 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -785,7 +785,7 @@ static int lp872x_regulator_register(struct lp872x *lp)
 	struct regulator_desc *desc;
 	struct regulator_config cfg = { };
 	struct regulator_dev *rdev;
-	int i, ret;
+	int i;
 
 	for (i = 0; i < lp->num_regulators; i++) {
 		desc = (lp->chipid == LP8720) ? &lp8720_regulator_desc[i] :
@@ -796,34 +796,16 @@ static int lp872x_regulator_register(struct lp872x *lp)
 		cfg.driver_data = lp;
 		cfg.regmap = lp->regmap;
 
-		rdev = regulator_register(desc, &cfg);
+		rdev = devm_regulator_register(lp->dev, desc, &cfg);
 		if (IS_ERR(rdev)) {
 			dev_err(lp->dev, "regulator register err");
-			ret =  PTR_ERR(rdev);
-			goto err;
+			return PTR_ERR(rdev);
 		}
 
 		*(lp->regulators + i) = rdev;
 	}
 
 	return 0;
-err:
-	while (--i >= 0) {
-		rdev = *(lp->regulators + i);
-		regulator_unregister(rdev);
-	}
-	return ret;
-}
-
-static void lp872x_regulator_unregister(struct lp872x *lp)
-{
-	struct regulator_dev *rdev;
-	int i;
-
-	for (i = 0; i < lp->num_regulators; i++) {
-		rdev = *(lp->regulators + i);
-		regulator_unregister(rdev);
-	}
 }
 
 static const struct regmap_config lp872x_regmap_config = {
@@ -979,14 +961,6 @@ err_dev:
 	return ret;
 }
 
-static int lp872x_remove(struct i2c_client *cl)
-{
-	struct lp872x *lp = i2c_get_clientdata(cl);
-
-	lp872x_regulator_unregister(lp);
-	return 0;
-}
-
 static const struct of_device_id lp872x_dt_ids[] = {
 	{ .compatible = "ti,lp8720", },
 	{ .compatible = "ti,lp8725", },
@@ -1008,7 +982,6 @@ static struct i2c_driver lp872x_driver = {
 		.of_match_table = of_match_ptr(lp872x_dt_ids),
 	},
 	.probe = lp872x_probe,
-	.remove = lp872x_remove,
 	.id_table = lp872x_ids,
 };
 
-- 
1.7.10.4



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

* [PATCH 11/20] regulator: lp8788-buck: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (8 preceding siblings ...)
  2013-09-25  8:03 ` [PATCH 10/20] regulator: lp872x: " Jingoo Han
@ 2013-09-25  8:04 ` Jingoo Han
  2013-09-25  8:05 ` [PATCH 12/20] regulator: lp8788-ldo: " Jingoo Han
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:04 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Milo Kim'

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/lp8788-buck.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/regulator/lp8788-buck.c b/drivers/regulator/lp8788-buck.c
index 0b015f2..948afc2 100644
--- a/drivers/regulator/lp8788-buck.c
+++ b/drivers/regulator/lp8788-buck.c
@@ -515,7 +515,7 @@ static int lp8788_buck_probe(struct platform_device *pdev)
 	cfg.driver_data = buck;
 	cfg.regmap = lp->regmap;
 
-	rdev = regulator_register(&lp8788_buck_desc[id], &cfg);
+	rdev = devm_regulator_register(&pdev->dev, &lp8788_buck_desc[id], &cfg);
 	if (IS_ERR(rdev)) {
 		ret = PTR_ERR(rdev);
 		dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n",
@@ -529,18 +529,8 @@ static int lp8788_buck_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int lp8788_buck_remove(struct platform_device *pdev)
-{
-	struct lp8788_buck *buck = platform_get_drvdata(pdev);
-
-	regulator_unregister(buck->regulator);
-
-	return 0;
-}
-
 static struct platform_driver lp8788_buck_driver = {
 	.probe = lp8788_buck_probe,
-	.remove = lp8788_buck_remove,
 	.driver = {
 		.name = LP8788_DEV_BUCK,
 		.owner = THIS_MODULE,
-- 
1.7.10.4



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

* [PATCH 12/20] regulator: lp8788-ldo: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (9 preceding siblings ...)
  2013-09-25  8:04 ` [PATCH 11/20] regulator: lp8788-buck: " Jingoo Han
@ 2013-09-25  8:05 ` Jingoo Han
  2013-09-25  8:06 ` [PATCH 13/20] regulator: max8925: " Jingoo Han
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:05 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Milo Kim'

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

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

diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c
index 0527d87..b9a29a2 100644
--- a/drivers/regulator/lp8788-ldo.c
+++ b/drivers/regulator/lp8788-ldo.c
@@ -543,7 +543,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev)
 	cfg.driver_data = ldo;
 	cfg.regmap = lp->regmap;
 
-	rdev = regulator_register(&lp8788_dldo_desc[id], &cfg);
+	rdev = devm_regulator_register(&pdev->dev, &lp8788_dldo_desc[id], &cfg);
 	if (IS_ERR(rdev)) {
 		ret = PTR_ERR(rdev);
 		dev_err(&pdev->dev, "DLDO%d regulator register err = %d\n",
@@ -557,18 +557,8 @@ static int lp8788_dldo_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int lp8788_dldo_remove(struct platform_device *pdev)
-{
-	struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
-
-	regulator_unregister(ldo->regulator);
-
-	return 0;
-}
-
 static struct platform_driver lp8788_dldo_driver = {
 	.probe = lp8788_dldo_probe,
-	.remove = lp8788_dldo_remove,
 	.driver = {
 		.name = LP8788_DEV_DLDO,
 		.owner = THIS_MODULE,
@@ -603,7 +593,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev)
 	cfg.driver_data = ldo;
 	cfg.regmap = lp->regmap;
 
-	rdev = regulator_register(&lp8788_aldo_desc[id], &cfg);
+	rdev = devm_regulator_register(&pdev->dev, &lp8788_aldo_desc[id], &cfg);
 	if (IS_ERR(rdev)) {
 		ret = PTR_ERR(rdev);
 		dev_err(&pdev->dev, "ALDO%d regulator register err = %d\n",
@@ -617,18 +607,8 @@ static int lp8788_aldo_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int lp8788_aldo_remove(struct platform_device *pdev)
-{
-	struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
-
-	regulator_unregister(ldo->regulator);
-
-	return 0;
-}
-
 static struct platform_driver lp8788_aldo_driver = {
 	.probe = lp8788_aldo_probe,
-	.remove = lp8788_aldo_remove,
 	.driver = {
 		.name = LP8788_DEV_ALDO,
 		.owner = THIS_MODULE,
-- 
1.7.10.4



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

* [PATCH 13/20] regulator: max8925: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (10 preceding siblings ...)
  2013-09-25  8:05 ` [PATCH 12/20] regulator: lp8788-ldo: " Jingoo Han
@ 2013-09-25  8:06 ` Jingoo Han
  2013-09-25  8:08 ` [PATCH 14/20] regulator: max8952: " Jingoo Han
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:06 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Haojian Zhuang'

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

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

diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c
index d80b5fa..7595107 100644
--- a/drivers/regulator/max8925-regulator.c
+++ b/drivers/regulator/max8925-regulator.c
@@ -312,7 +312,7 @@ static int max8925_regulator_probe(struct platform_device *pdev)
 		if (pdata)
 			config.init_data = pdata;
 
-	rdev = regulator_register(&ri->desc, &config);
+	rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
 	if (IS_ERR(rdev)) {
 		dev_err(&pdev->dev, "failed to register regulator %s\n",
 				ri->desc.name);
@@ -323,22 +323,12 @@ static int max8925_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int max8925_regulator_remove(struct platform_device *pdev)
-{
-	struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-	regulator_unregister(rdev);
-
-	return 0;
-}
-
 static struct platform_driver max8925_regulator_driver = {
 	.driver		= {
 		.name	= "max8925-regulator",
 		.owner	= THIS_MODULE,
 	},
 	.probe		= max8925_regulator_probe,
-	.remove		= max8925_regulator_remove,
 };
 
 static int __init max8925_regulator_init(void)
-- 
1.7.10.4



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

* [PATCH 14/20] regulator: max8952: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (11 preceding siblings ...)
  2013-09-25  8:06 ` [PATCH 13/20] regulator: max8925: " Jingoo Han
@ 2013-09-25  8:08 ` Jingoo Han
  2013-09-25  8:09 ` [PATCH 15/20] regulator: pcap: " Jingoo Han
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:08 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'MyungJoo Ham'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 788e5ae..6fb7ec1 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -231,7 +231,8 @@ static int max8952_pmic_probe(struct i2c_client *client,
 	if (pdata->reg_data->constraints.boot_on)
 		config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
 
-	max8952->rdev = regulator_register(&regulator, &config);
+	max8952->rdev = devm_regulator_register(&client->dev, &regulator,
+						&config);
 
 	if (IS_ERR(max8952->rdev)) {
 		ret = PTR_ERR(max8952->rdev);
@@ -321,9 +322,6 @@ static int max8952_pmic_remove(struct i2c_client *client)
 {
 	struct max8952_data *max8952 = i2c_get_clientdata(client);
 	struct max8952_platform_data *pdata = max8952->pdata;
-	struct regulator_dev *rdev = max8952->rdev;
-
-	regulator_unregister(rdev);
 
 	gpio_free(pdata->gpio_vid0);
 	gpio_free(pdata->gpio_vid1);
-- 
1.7.10.4



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

* [PATCH 15/20] regulator: pcap: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (12 preceding siblings ...)
  2013-09-25  8:08 ` [PATCH 14/20] regulator: max8952: " Jingoo Han
@ 2013-09-25  8:09 ` Jingoo Han
  2013-09-25  8:11 ` [PATCH 16/20] regulator: pcf50633: " Jingoo Han
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:09 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han'

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

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

diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c
index b49eaee..3727b7d 100644
--- a/drivers/regulator/pcap-regulator.c
+++ b/drivers/regulator/pcap-regulator.c
@@ -246,7 +246,8 @@ static int pcap_regulator_probe(struct platform_device *pdev)
 	config.init_data = dev_get_platdata(&pdev->dev);
 	config.driver_data = pcap;
 
-	rdev = regulator_register(&pcap_regulators[pdev->id], &config);
+	rdev = devm_regulator_register(&pdev->dev, &pcap_regulators[pdev->id],
+				       &config);
 	if (IS_ERR(rdev))
 		return PTR_ERR(rdev);
 
@@ -255,22 +256,12 @@ static int pcap_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int pcap_regulator_remove(struct platform_device *pdev)
-{
-	struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-	regulator_unregister(rdev);
-
-	return 0;
-}
-
 static struct platform_driver pcap_regulator_driver = {
 	.driver = {
 		.name	= "pcap-regulator",
 		.owner	= THIS_MODULE,
 	},
 	.probe	= pcap_regulator_probe,
-	.remove	= pcap_regulator_remove,
 };
 
 static int __init pcap_regulator_init(void)
-- 
1.7.10.4



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

* [PATCH 16/20] regulator: pcf50633: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (13 preceding siblings ...)
  2013-09-25  8:09 ` [PATCH 15/20] regulator: pcap: " Jingoo Han
@ 2013-09-25  8:11 ` Jingoo Han
  2013-09-25  8:12 ` [PATCH 17/20] regulator: tps6105x: " Jingoo Han
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:11 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Lars-Peter Clausen'

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

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

diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c
index 0f3576d..d7da1c1 100644
--- a/drivers/regulator/pcf50633-regulator.c
+++ b/drivers/regulator/pcf50633-regulator.c
@@ -90,7 +90,8 @@ static int pcf50633_regulator_probe(struct platform_device *pdev)
 	config.driver_data = pcf;
 	config.regmap = pcf->regmap;
 
-	rdev = regulator_register(&regulators[pdev->id], &config);
+	rdev = devm_regulator_register(&pdev->dev, &regulators[pdev->id],
+				       &config);
 	if (IS_ERR(rdev))
 		return PTR_ERR(rdev);
 
@@ -102,21 +103,11 @@ static int pcf50633_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int pcf50633_regulator_remove(struct platform_device *pdev)
-{
-	struct regulator_dev *rdev = platform_get_drvdata(pdev);
-
-	regulator_unregister(rdev);
-
-	return 0;
-}
-
 static struct platform_driver pcf50633_regulator_driver = {
 	.driver = {
 		.name = "pcf50633-regltr",
 	},
 	.probe = pcf50633_regulator_probe,
-	.remove = pcf50633_regulator_remove,
 };
 
 static int __init pcf50633_regulator_init(void)
-- 
1.7.10.4



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

* [PATCH 17/20] regulator: tps6105x: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (14 preceding siblings ...)
  2013-09-25  8:11 ` [PATCH 16/20] regulator: pcf50633: " Jingoo Han
@ 2013-09-25  8:12 ` Jingoo Han
  2013-09-27 12:42   ` Linus Walleij
  2013-09-25  8:13 ` [PATCH 18/20] regulator: tps6524x: " Jingoo Han
                   ` (3 subsequent siblings)
  19 siblings, 1 reply; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8: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/tps6105x-regulator.c |   13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c
index ec9453f..e0e818d 100644
--- a/drivers/regulator/tps6105x-regulator.c
+++ b/drivers/regulator/tps6105x-regulator.c
@@ -146,8 +146,9 @@ static int tps6105x_regulator_probe(struct platform_device *pdev)
 	config.driver_data = tps6105x;
 
 	/* Register regulator with framework */
-	tps6105x->regulator = regulator_register(&tps6105x_regulator_desc,
-						 &config);
+	tps6105x->regulator = devm_regulator_register(&pdev->dev,
+						      &tps6105x_regulator_desc,
+						      &config);
 	if (IS_ERR(tps6105x->regulator)) {
 		ret = PTR_ERR(tps6105x->regulator);
 		dev_err(&tps6105x->client->dev,
@@ -159,20 +160,12 @@ static int tps6105x_regulator_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int tps6105x_regulator_remove(struct platform_device *pdev)
-{
-	struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev);
-	regulator_unregister(tps6105x->regulator);
-	return 0;
-}
-
 static struct platform_driver tps6105x_regulator_driver = {
 	.driver = {
 		.name  = "tps6105x-regulator",
 		.owner = THIS_MODULE,
 	},
 	.probe = tps6105x_regulator_probe,
-	.remove = tps6105x_regulator_remove,
 };
 
 static __init int tps6105x_regulator_init(void)
-- 
1.7.10.4



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

* [PATCH 18/20] regulator: tps6524x: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (15 preceding siblings ...)
  2013-09-25  8:12 ` [PATCH 17/20] regulator: tps6105x: " Jingoo Han
@ 2013-09-25  8:13 ` Jingoo Han
  2013-09-25  8:15 ` [PATCH 19/20] regulator: twl: " Jingoo Han
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:13 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Axel Lin'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 8b9ee39..8fe67fb 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -584,10 +584,8 @@ static int pmic_remove(struct spi_device *spi)
 
 	if (!hw)
 		return 0;
-	for (i = 0; i < N_REGULATORS; i++) {
-		regulator_unregister(hw->rdev[i]);
+	for (i = 0; i < N_REGULATORS; i++)
 		hw->rdev[i] = NULL;
-	}
 	return 0;
 }
 
@@ -631,7 +629,8 @@ static int pmic_probe(struct spi_device *spi)
 		config.init_data = init_data;
 		config.driver_data = hw;
 
-		hw->rdev[i] = regulator_register(&hw->desc[i], &config);
+		hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
+						      &config);
 		if (IS_ERR(hw->rdev[i])) {
 			ret = PTR_ERR(hw->rdev[i]);
 			hw->rdev[i] = NULL;
-- 
1.7.10.4



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

* [PATCH 19/20] regulator: twl: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (16 preceding siblings ...)
  2013-09-25  8:13 ` [PATCH 18/20] regulator: tps6524x: " Jingoo Han
@ 2013-09-25  8:15 ` Jingoo Han
  2013-09-25 12:59   ` Nishanth Menon
  2013-09-25  8:17 ` [PATCH 20/20] regulator: vexpress: " Jingoo Han
  2013-09-27 12:41 ` [PATCH 01/20] regulator: ab3100: " Linus Walleij
  19 siblings, 1 reply; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:15 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Balaji T K', 'Nishanth Menon'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 78aae4c..8ebd785 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1188,7 +1188,7 @@ static int twlreg_probe(struct platform_device *pdev)
 	config.driver_data = info;
 	config.of_node = pdev->dev.of_node;
 
-	rdev = regulator_register(&info->desc, &config);
+	rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
 	if (IS_ERR(rdev)) {
 		dev_err(&pdev->dev, "can't register %s, %ld\n",
 				info->desc.name, PTR_ERR(rdev));
@@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev)
 	struct regulator_dev *rdev = platform_get_drvdata(pdev);
 	struct twlreg_info *info = rdev->reg_data;
 
-	regulator_unregister(rdev);
 	kfree(info);
 	return 0;
 }
-- 
1.7.10.4



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

* [PATCH 20/20] regulator: vexpress: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (17 preceding siblings ...)
  2013-09-25  8:15 ` [PATCH 19/20] regulator: twl: " Jingoo Han
@ 2013-09-25  8:17 ` Jingoo Han
  2013-09-25 10:56   ` Pawel Moll
  2013-09-27 12:41 ` [PATCH 01/20] regulator: ab3100: " Linus Walleij
  19 siblings, 1 reply; 28+ messages in thread
From: Jingoo Han @ 2013-09-25  8:17 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: 'Liam Girdwood', linux-kernel, 'Jingoo Han',
	'Pawel Moll'

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/vexpress.c b/drivers/regulator/vexpress.c
index 4668c7f..f3ae28a 100644
--- a/drivers/regulator/vexpress.c
+++ b/drivers/regulator/vexpress.c
@@ -96,7 +96,7 @@ static int vexpress_regulator_probe(struct platform_device *pdev)
 	config.driver_data = reg;
 	config.of_node = pdev->dev.of_node;
 
-	reg->regdev = regulator_register(&reg->desc, &config);
+	reg->regdev = devm_regulator_register(&pdev->dev, &reg->desc, &config);
 	if (IS_ERR(reg->regdev)) {
 		err = PTR_ERR(reg->regdev);
 		goto error_regulator_register;
@@ -119,7 +119,6 @@ static int vexpress_regulator_remove(struct platform_device *pdev)
 	struct vexpress_regulator *reg = platform_get_drvdata(pdev);
 
 	vexpress_config_func_put(reg->func);
-	regulator_unregister(reg->regdev);
 
 	return 0;
 }
-- 
1.7.10.4



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

* Re: [PATCH 09/20] regulator: lp3972: use devm_regulator_register()
  2013-09-25  8:02 ` [PATCH 09/20] regulator: lp3972: " Jingoo Han
@ 2013-09-25 10:17   ` Sachin Kamat
  2013-09-26  1:17     ` Jingoo Han
  0 siblings, 1 reply; 28+ messages in thread
From: Sachin Kamat @ 2013-09-25 10:17 UTC (permalink / raw)
  To: Jingoo Han; +Cc: Mark Brown, Liam Girdwood, LKML, Marek Szyprowski

On 25 September 2013 13:32, Jingoo Han <jg1.han@samsung.com> wrote:
> Use devm_regulator_register() to make cleanup paths simpler.

>  static int lp3972_i2c_remove(struct i2c_client *i2c)
>  {
>         struct lp3972 *lp3972 = i2c_get_clientdata(i2c);
> -       int i;
>
> -       for (i = 0; i < lp3972->num_regulators; i++)
> -               regulator_unregister(lp3972->rdev[i]);
>         kfree(lp3972->rdev);

With devm the unregister would happen after the freeing of the device.
Wouldn't this re-ordering cause any
problems?

-- 
With warm regards,
Sachin

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

* Re: [PATCH 02/20] regulator: ab8500: use devm_regulator_register()
  2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
@ 2013-09-25 10:20   ` Sachin Kamat
  2013-09-26  1:25     ` Jingoo Han
  0 siblings, 1 reply; 28+ messages in thread
From: Sachin Kamat @ 2013-09-25 10:20 UTC (permalink / raw)
  To: Jingoo Han; +Cc: Mark Brown, Liam Girdwood, LKML, Bengt Jonsson

On 25 September 2013 13:21, Jingoo Han <jg1.han@samsung.com> wrote:
> Use devm_regulator_register() to make cleanup paths simpler.

> -       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);

Wouldn't re-ordering (unregistering after ab8500_regulator_debug_exit)
cause any problems here ?

-- 
With warm regards,
Sachin

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

* Re: [PATCH 20/20] regulator: vexpress: use devm_regulator_register()
  2013-09-25  8:17 ` [PATCH 20/20] regulator: vexpress: " Jingoo Han
@ 2013-09-25 10:56   ` Pawel Moll
  0 siblings, 0 replies; 28+ messages in thread
From: Pawel Moll @ 2013-09-25 10:56 UTC (permalink / raw)
  To: Jingoo Han; +Cc: 'Mark Brown', 'Liam Girdwood', linux-kernel

On Wed, 2013-09-25 at 09:17 +0100, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/regulator/vexpress.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/vexpress.c b/drivers/regulator/vexpress.c
> index 4668c7f..f3ae28a 100644
> --- a/drivers/regulator/vexpress.c
> +++ b/drivers/regulator/vexpress.c
> @@ -96,7 +96,7 @@ static int vexpress_regulator_probe(struct platform_device *pdev)
>  	config.driver_data = reg;
>  	config.of_node = pdev->dev.of_node;
>  
> -	reg->regdev = regulator_register(&reg->desc, &config);
> +	reg->regdev = devm_regulator_register(&pdev->dev, &reg->desc, &config);
>  	if (IS_ERR(reg->regdev)) {
>  		err = PTR_ERR(reg->regdev);
>  		goto error_regulator_register;
> @@ -119,7 +119,6 @@ static int vexpress_regulator_remove(struct platform_device *pdev)
>  	struct vexpress_regulator *reg = platform_get_drvdata(pdev);
>  
>  	vexpress_config_func_put(reg->func);
> -	regulator_unregister(reg->regdev);
>  
>  	return 0;
>  }

I'm assuming it's following a patch adding devm_regulator_register()?

Based on this:

Acked-by: Pawel Moll <pawel.moll@arm.com>

Thanks!

Pawel



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

* Re: [PATCH 19/20] regulator: twl: use devm_regulator_register()
  2013-09-25  8:15 ` [PATCH 19/20] regulator: twl: " Jingoo Han
@ 2013-09-25 12:59   ` Nishanth Menon
  0 siblings, 0 replies; 28+ messages in thread
From: Nishanth Menon @ 2013-09-25 12:59 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Mark Brown', 'Liam Girdwood',
	linux-kernel, 'Balaji T K'

On 17:15-20130925, Jingoo Han wrote:
> Use devm_regulator_register() to make cleanup paths simpler.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/regulator/twl-regulator.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
> index 78aae4c..8ebd785 100644
> --- a/drivers/regulator/twl-regulator.c
> +++ b/drivers/regulator/twl-regulator.c
> @@ -1188,7 +1188,7 @@ static int twlreg_probe(struct platform_device *pdev)
>  	config.driver_data = info;
>  	config.of_node = pdev->dev.of_node;
>  
> -	rdev = regulator_register(&info->desc, &config);
> +	rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
>  	if (IS_ERR(rdev)) {
>  		dev_err(&pdev->dev, "can't register %s, %ld\n",
>  				info->desc.name, PTR_ERR(rdev));
> @@ -1217,7 +1217,6 @@ static int twlreg_remove(struct platform_device *pdev)
>  	struct regulator_dev *rdev = platform_get_drvdata(pdev);
>  	struct twlreg_info *info = rdev->reg_data;
>  
> -	regulator_unregister(rdev);
>  	kfree(info);
>  	return 0;
>  }
> -- 
> 1.7.10.4
> 
> 
Acked-by: Nishanth Menon <nm@ti.com>
-- 
Regards,
Nishanth Menon

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

* Re: [PATCH 09/20] regulator: lp3972: use devm_regulator_register()
  2013-09-25 10:17   ` Sachin Kamat
@ 2013-09-26  1:17     ` Jingoo Han
  0 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-26  1:17 UTC (permalink / raw)
  To: 'Sachin Kamat'
  Cc: 'Mark Brown', 'Liam Girdwood', 'LKML',
	'Marek Szyprowski', 'Jingoo Han'

On Wednesday, September 25, 2013 7:18 PM, Sachin Kamat wrote:
> On 25 September 2013 13:32, Jingoo Han <jg1.han@samsung.com> wrote:
> > Use devm_regulator_register() to make cleanup paths simpler.
> 
> >  static int lp3972_i2c_remove(struct i2c_client *i2c)
> >  {
> >         struct lp3972 *lp3972 = i2c_get_clientdata(i2c);
> > -       int i;
> >
> > -       for (i = 0; i < lp3972->num_regulators; i++)
> > -               regulator_unregister(lp3972->rdev[i]);
> >         kfree(lp3972->rdev);
> 
> With devm the unregister would happen after the freeing of the device.
> Wouldn't this re-ordering cause any
> problems?

It seems to make the problem.
I will remove this patch from next V2 patch series.
Thank you.

Best regards,
Jingoo Han


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

* Re: [PATCH 02/20] regulator: ab8500: use devm_regulator_register()
  2013-09-25 10:20   ` Sachin Kamat
@ 2013-09-26  1:25     ` Jingoo Han
  0 siblings, 0 replies; 28+ messages in thread
From: Jingoo Han @ 2013-09-26  1:25 UTC (permalink / raw)
  To: 'Sachin Kamat'
  Cc: 'Mark Brown', 'Liam Girdwood', 'LKML',
	'Bengt Jonsson', 'Jingoo Han'

On Wednesday, September 25, 2013 7:21 PM, Sachin Kamat wrote:
> On 25 September 2013 13:21, Jingoo Han <jg1.han@samsung.com> wrote:
> > Use devm_regulator_register() to make cleanup paths simpler.
> 
> > -       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);
> 
> Wouldn't re-ordering (unregistering after ab8500_regulator_debug_exit)
> cause any problems here ?
> 

OK, I see. 
There is no ab8500_regulator_debug_exit() in the current kernel.
However, in my opinion, ab8500_regulator_debug_exit() should be
called, after regulator_unregister() is called.

I will remove this patch from next V2 patch series.
Thank you.

Bengt Jonsson,
If I am wrong, please let me know kindly. :-)

Best regards,
Jingoo Han


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

* Re: [PATCH 01/20] regulator: ab3100: use devm_regulator_register()
  2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
                   ` (18 preceding siblings ...)
  2013-09-25  8:17 ` [PATCH 20/20] regulator: vexpress: " Jingoo Han
@ 2013-09-27 12:41 ` Linus Walleij
  19 siblings, 0 replies; 28+ messages in thread
From: Linus Walleij @ 2013-09-27 12:41 UTC (permalink / raw)
  To: Jingoo Han; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Sep 25, 2013 at 9:48 AM, Jingoo Han <jg1.han@samsung.com> wrote:

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

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

Yours,
Linus Walleij

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

* Re: [PATCH 17/20] regulator: tps6105x: use devm_regulator_register()
  2013-09-25  8:12 ` [PATCH 17/20] regulator: tps6105x: " Jingoo Han
@ 2013-09-27 12:42   ` Linus Walleij
  0 siblings, 0 replies; 28+ messages in thread
From: Linus Walleij @ 2013-09-27 12:42 UTC (permalink / raw)
  To: Jingoo Han; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Wed, Sep 25, 2013 at 10: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>

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

Yours,
Linus Walleij

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

end of thread, other threads:[~2013-09-27 12:42 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
2013-09-25 10:20   ` Sachin Kamat
2013-09-26  1:25     ` Jingoo Han
2013-09-25  7:52 ` [PATCH 03/20] regulator: ab8500-ext: " Jingoo Han
2013-09-25  7:55 ` [PATCH 04/20] regulator: da9063: " Jingoo Han
2013-09-25  7:56 ` [PATCH 05/20] regulator: da9210: " Jingoo Han
2013-09-25  7:58 ` [PATCH 06/20] regulator: fixed: " Jingoo Han
2013-09-25  8:00 ` [PATCH 07/20] regulator: gpio-regulator: " Jingoo Han
2013-09-25  8:01 ` [PATCH 08/20] regulator: lp3971: " Jingoo Han
2013-09-25  8:02 ` [PATCH 09/20] regulator: lp3972: " Jingoo Han
2013-09-25 10:17   ` Sachin Kamat
2013-09-26  1:17     ` Jingoo Han
2013-09-25  8:03 ` [PATCH 10/20] regulator: lp872x: " Jingoo Han
2013-09-25  8:04 ` [PATCH 11/20] regulator: lp8788-buck: " Jingoo Han
2013-09-25  8:05 ` [PATCH 12/20] regulator: lp8788-ldo: " Jingoo Han
2013-09-25  8:06 ` [PATCH 13/20] regulator: max8925: " Jingoo Han
2013-09-25  8:08 ` [PATCH 14/20] regulator: max8952: " Jingoo Han
2013-09-25  8:09 ` [PATCH 15/20] regulator: pcap: " Jingoo Han
2013-09-25  8:11 ` [PATCH 16/20] regulator: pcf50633: " Jingoo Han
2013-09-25  8:12 ` [PATCH 17/20] regulator: tps6105x: " Jingoo Han
2013-09-27 12:42   ` Linus Walleij
2013-09-25  8:13 ` [PATCH 18/20] regulator: tps6524x: " Jingoo Han
2013-09-25  8:15 ` [PATCH 19/20] regulator: twl: " Jingoo Han
2013-09-25 12:59   ` Nishanth Menon
2013-09-25  8:17 ` [PATCH 20/20] regulator: vexpress: " Jingoo Han
2013-09-25 10:56   ` Pawel Moll
2013-09-27 12:41 ` [PATCH 01/20] regulator: ab3100: " Linus Walleij

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.