public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Mark Brown'" <broonie@kernel.org>
Cc: "'Liam Girdwood'" <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org,
	"'Jingoo Han'" <jg1.han@samsung.com>,
	"'Axel Lin'" <axel.lin@ingics.com>
Subject: [PATCH V4 12/14] regulator: tps6524x: use devm_regulator_register()
Date: Mon, 30 Sep 2013 09:58:36 +0900	[thread overview]
Message-ID: <007f01cebd78$31657160$94305420$%han@samsung.com> (raw)
In-Reply-To: <007401cebd77$0652a340$12f7e9c0$%han@samsung.com>

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

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps6524x-regulator.c |   31 +++++--------------------------
 1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 8b9ee39..9f6bfda 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -577,20 +577,6 @@ static struct regulator_ops regulator_ops = {
 	.get_current_limit	= get_current_limit,
 };
 
-static int pmic_remove(struct spi_device *spi)
-{
-	struct tps6524x *hw = spi_get_drvdata(spi);
-	int i;
-
-	if (!hw)
-		return 0;
-	for (i = 0; i < N_REGULATORS; i++) {
-		regulator_unregister(hw->rdev[i]);
-		hw->rdev[i] = NULL;
-	}
-	return 0;
-}
-
 static int pmic_probe(struct spi_device *spi)
 {
 	struct tps6524x *hw;
@@ -598,7 +584,7 @@ static int pmic_probe(struct spi_device *spi)
 	const struct supply_info *info = supply_info;
 	struct regulator_init_data *init_data;
 	struct regulator_config config = { };
-	int ret = 0, i;
+	int i;
 
 	init_data = dev_get_platdata(dev);
 	if (!init_data) {
@@ -631,24 +617,17 @@ 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);
-		if (IS_ERR(hw->rdev[i])) {
-			ret = PTR_ERR(hw->rdev[i]);
-			hw->rdev[i] = NULL;
-			goto fail;
-		}
+		hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
+						      &config);
+		if (IS_ERR(hw->rdev[i]))
+			return PTR_ERR(hw->rdev[i]);
 	}
 
 	return 0;
-
-fail:
-	pmic_remove(spi);
-	return ret;
 }
 
 static struct spi_driver pmic_driver = {
 	.probe		= pmic_probe,
-	.remove		= pmic_remove,
 	.driver		= {
 		.name	= "tps6524x",
 		.owner	= THIS_MODULE,
-- 
1.7.10.4



  parent reply	other threads:[~2013-09-30  0:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30  0:50 [PATCH V4 01/14] regulator: ab3100: use devm_regulator_register() Jingoo Han
2013-09-30  0:52 ` [PATCH V4 02/14] regulator: ab8500-ext: " Jingoo Han
2013-09-30  0:53 ` [PATCH V4 03/14] regulator: da9063: " Jingoo Han
2013-09-30  0:53 ` [PATCH V4 04/14] regulator: da9210: " Jingoo Han
2013-09-30  0:54 ` [PATCH V4 05/14] regulator: lp872x: " Jingoo Han
2013-09-30  0:55 ` [PATCH V4 06/14] regulator: lp8788-buck: " Jingoo Han
2013-09-30  0:55 ` [PATCH V4 07/14] regulator: lp8788-ldo: " Jingoo Han
2013-09-30  0:56 ` [PATCH V4 08/14] regulator: max8925: " Jingoo Han
2013-09-30  0:56 ` [PATCH V4 09/14] regulator: pcap: " Jingoo Han
2013-09-30  0:57 ` [PATCH V4 10/14] regulator: pcf50633: " Jingoo Han
2013-09-30  0:57 ` [PATCH V4 11/14] regulator: tps6105x: " Jingoo Han
2013-09-30  0:58 ` Jingoo Han [this message]
2013-09-30  0:59 ` [PATCH V4 13/14] regulator: twl: " Jingoo Han
2013-09-30  0:59 ` [PATCH V4 14/14] regulator: vexpress: " Jingoo Han
2013-09-30 17:12 ` [PATCH V4 01/14] regulator: ab3100: " 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='007f01cebd78$31657160$94305420$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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