mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/9] regulator: max77686: Use devm_regulator_register
@ 2013-09-04  5:37 Sachin Kamat
  2013-09-04  5:37 ` [PATCH 2/9] regulator: max1586: " Sachin Kamat
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Sachin Kamat @ 2013-09-04  5:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: broonie, sachin.kamat, kyungmin.park, myungjoo.ham, ldewangan,
	jack.yoo, haojian.zhuang, jonghwa3.lee

devm_* simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
This series is compile tested.
---
 drivers/regulator/max77686.c |   22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index f563057..de5b30e 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -478,32 +478,17 @@ static int max77686_pmic_probe(struct platform_device *pdev)
 		config.of_node = pdata->regulators[i].of_node;
 
 		max77686->opmode[i] = regulators[i].enable_mask;
-		max77686->rdev[i] = regulator_register(&regulators[i], &config);
+		max77686->rdev[i] = devm_regulator_register(&pdev->dev,
+						&regulators[i], &config);
 		if (IS_ERR(max77686->rdev[i])) {
-			ret = PTR_ERR(max77686->rdev[i]);
 			dev_err(&pdev->dev,
 				"regulator init failed for %d\n", i);
 			max77686->rdev[i] = NULL;
-			goto err;
+			return PTR_ERR(max77686->rdev[i]);
 		}
 	}
 
 	return 0;
-err:
-	while (--i >= 0)
-		regulator_unregister(max77686->rdev[i]);
-	return ret;
-}
-
-static int max77686_pmic_remove(struct platform_device *pdev)
-{
-	struct max77686_data *max77686 = platform_get_drvdata(pdev);
-	int i;
-
-	for (i = 0; i < MAX77686_REGULATORS; i++)
-		regulator_unregister(max77686->rdev[i]);
-
-	return 0;
 }
 
 static const struct platform_device_id max77686_pmic_id[] = {
@@ -518,7 +503,6 @@ static struct platform_driver max77686_pmic_driver = {
 		.owner = THIS_MODULE,
 	},
 	.probe = max77686_pmic_probe,
-	.remove = max77686_pmic_remove,
 	.id_table = max77686_pmic_id,
 };
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-09-04  9:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-04  5:37 [PATCH 1/9] regulator: max77686: Use devm_regulator_register Sachin Kamat
2013-09-04  5:37 ` [PATCH 2/9] regulator: max1586: " Sachin Kamat
2013-09-04  5:37 ` [PATCH 3/9] regulator: max77693: " Sachin Kamat
2013-09-04  5:37 ` [PATCH 4/9] regulator: max8649: " Sachin Kamat
2013-09-04  5:37 ` [PATCH 5/9] regulator: max8660: " Sachin Kamat
2013-09-04  5:37 ` [PATCH 6/9] regulator: max8907-regulator: " Sachin Kamat
2013-09-04  5:38 ` [PATCH 7/9] regulator: max8973-regulator: " Sachin Kamat
2013-09-04  5:38 ` [PATCH 8/9] regulator: max8997: " Sachin Kamat
2013-09-04  5:38 ` [PATCH 9/9] regulator: max8998: " Sachin Kamat
2013-09-04  9:52 ` [PATCH 1/9] regulator: max77686: " Mark Brown

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

all inboxes | Powered by JetHome®