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>,
	"'Bengt Jonsson'" <bengt.g.jonsson@stericsson.com>
Subject: [PATCH 2/6] regulator: db8500-prcmu: use devm_regulator_register()
Date: Fri, 06 Dec 2013 16:08:38 +0900	[thread overview]
Message-ID: <000b01cef251$fc6df360$f549da20$%han@samsung.com> (raw)
In-Reply-To: <000a01cef251$c79ea9e0$56dbfda0$%han@samsung.com>

Use devm_regulator_register() to make cleanup paths simpler.

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

diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index a53c11a..846acf2 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -431,17 +431,11 @@ static int db8500_regulator_register(struct platform_device *pdev,
 	config.of_node = np;
 
 	/* register with the regulator 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 %s: err %i\n",
 			info->desc.name, err);
-
-		/* if failing, unregister all earlier regulators */
-		while (--id >= 0) {
-			info = &dbx500_regulator_info[id];
-			regulator_unregister(info->rdev);
-		}
 		return err;
 	}
 
@@ -530,20 +524,8 @@ static int db8500_regulator_probe(struct platform_device *pdev)
 
 static int db8500_regulator_remove(struct platform_device *pdev)
 {
-	int i;
-
 	ux500_regulator_debug_exit();
 
-	for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
-		struct dbx500_regulator_info *info;
-		info = &dbx500_regulator_info[i];
-
-		dev_vdbg(rdev_get_dev(info->rdev),
-			"regulator-%s-remove\n", info->desc.name);
-
-		regulator_unregister(info->rdev);
-	}
-
 	return 0;
 }
 
-- 
1.7.10.4



  reply	other threads:[~2013-12-06  7:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06  7:07 [PATCH 1/6] regulator: ab8500: use devm_regulator_register() Jingoo Han
2013-12-06  7:08 ` Jingoo Han [this message]
2013-12-06  8:35   ` [PATCH 2/6] regulator: db8500-prcmu: " 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

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='000b01cef251$fc6df360$f549da20$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=bengt.g.jonsson@stericsson.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