mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sachin Kamat <sachin.kamat@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: broonie@kernel.org, sachin.kamat@linaro.org,
	ldewangan@nvidia.com, magi@slimlogic.co.uk, gg@slimlogic.co.uk,
	mike@compulab.co.il, anilkumar@ti.com, vbyravarasu@nvidia.com
Subject: [PATCH 04/10] regulator: tps6507x: Use devm_regulator_register
Date: Wed,  4 Sep 2013 17:17:47 +0530	[thread overview]
Message-ID: <1378295273-32257-4-git-send-email-sachin.kamat@linaro.org> (raw)
In-Reply-To: <1378295273-32257-1-git-send-email-sachin.kamat@linaro.org>

devm_* simplifies the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/regulator/tps6507x-regulator.c |   23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 4117ff5..162a0fa 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -508,13 +508,13 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
 			config.of_node = tps6507x_reg_matches[i].of_node;
 		}
 
-		rdev = regulator_register(&tps->desc[i], &config);
+		rdev = devm_regulator_register(&pdev->dev, &tps->desc[i],
+					       &config);
 		if (IS_ERR(rdev)) {
 			dev_err(tps6507x_dev->dev,
 				"failed to register %s regulator\n",
 				pdev->name);
-			error = PTR_ERR(rdev);
-			goto fail;
+			return PTR_ERR(rdev);
 		}
 
 		/* Save regulator for cleanup */
@@ -525,22 +525,6 @@ static int tps6507x_pmic_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, tps6507x_dev);
 
 	return 0;
-
-fail:
-	while (--i >= 0)
-		regulator_unregister(tps->rdev[i]);
-	return error;
-}
-
-static int tps6507x_pmic_remove(struct platform_device *pdev)
-{
-	struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
-	struct tps6507x_pmic *tps = tps6507x_dev->pmic;
-	int i;
-
-	for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
-		regulator_unregister(tps->rdev[i]);
-	return 0;
 }
 
 static struct platform_driver tps6507x_pmic_driver = {
@@ -549,7 +533,6 @@ static struct platform_driver tps6507x_pmic_driver = {
 		.owner = THIS_MODULE,
 	},
 	.probe = tps6507x_pmic_probe,
-	.remove = tps6507x_pmic_remove,
 };
 
 static int __init tps6507x_pmic_init(void)
-- 
1.7.9.5


  parent reply	other threads:[~2013-09-04 12:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 11:47 [PATCH 01/10] regulator: tps51632: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 02/10] regulator: tps62360: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 03/10] regulator: tps65023: " Sachin Kamat
2013-09-04 11:47 ` Sachin Kamat [this message]
2013-09-04 11:47 ` [PATCH 05/10] regulator: tps65090: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 06/10] regulator: tps65217: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 07/10] regulator: tps6586x: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 08/10] regulator: tps65910: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 09/10] regulator: tps65912: " Sachin Kamat
2013-09-04 11:47 ` [PATCH 10/10] regulator: tps80031: " Sachin Kamat
2013-09-04 18:53 ` [PATCH 01/10] regulator: tps51632: " Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378295273-32257-4-git-send-email-sachin.kamat@linaro.org \
    --to=sachin.kamat@linaro.org \
    --cc=anilkumar@ti.com \
    --cc=broonie@kernel.org \
    --cc=gg@slimlogic.co.uk \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magi@slimlogic.co.uk \
    --cc=mike@compulab.co.il \
    --cc=vbyravarasu@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®