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

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