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>,
"'Geert Uytterhoeven'" <geert@linux-m68k.org>,
"'Krystian Garbaciak'" <krystian.garbaciak@diasemi.com>
Subject: [PATCH V4 03/14] regulator: da9063: use devm_regulator_register()
Date: Mon, 30 Sep 2013 09:53:09 +0900 [thread overview]
Message-ID: <007601cebd77$6e616e80$4b244b80$%han@samsung.com> (raw)
In-Reply-To: <007401cebd77$0652a340$12f7e9c0$%han@samsung.com>
Use devm_regulator_register() to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/regulator/da9063-regulator.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c
index 3d910f4..56727eb 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -847,13 +847,13 @@ static int da9063_regulator_probe(struct platform_device *pdev)
if (da9063_reg_matches)
config.of_node = da9063_reg_matches[id].of_node;
config.regmap = da9063->regmap;
- regl->rdev = regulator_register(®l->desc, &config);
+ regl->rdev = devm_regulator_register(&pdev->dev, ®l->desc,
+ &config);
if (IS_ERR(regl->rdev)) {
dev_err(&pdev->dev,
"Failed to register %s regulator\n",
regl->desc.name);
- ret = PTR_ERR(regl->rdev);
- goto err;
+ return PTR_ERR(regl->rdev);
}
id++;
n++;
@@ -862,9 +862,8 @@ static int da9063_regulator_probe(struct platform_device *pdev)
/* LDOs overcurrent event support */
irq = platform_get_irq_byname(pdev, "LDO_LIM");
if (irq < 0) {
- ret = irq;
dev_err(&pdev->dev, "Failed to get IRQ.\n");
- goto err;
+ return irq;
}
regulators->irq_ldo_lim = regmap_irq_get_virq(da9063->regmap_irq, irq);
@@ -881,27 +880,15 @@ static int da9063_regulator_probe(struct platform_device *pdev)
}
return 0;
-
-err:
- /* Wind back regulators registeration */
- while (--n >= 0)
- regulator_unregister(regulators->regulator[n].rdev);
-
- return ret;
}
static int da9063_regulator_remove(struct platform_device *pdev)
{
struct da9063_regulators *regulators = platform_get_drvdata(pdev);
- struct da9063_regulator *regl;
free_irq(regulators->irq_ldo_lim, regulators);
free_irq(regulators->irq_uvov, regulators);
- for (regl = ®ulators->regulator[regulators->n_regulators - 1];
- regl >= ®ulators->regulator[0]; regl--)
- regulator_unregister(regl->rdev);
-
return 0;
}
--
1.7.10.4
next prev parent reply other threads:[~2013-09-30 0:53 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 ` Jingoo Han [this message]
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 ` [PATCH V4 12/14] regulator: tps6524x: " Jingoo Han
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='007601cebd77$6e616e80$4b244b80$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=broonie@kernel.org \
--cc=geert@linux-m68k.org \
--cc=krystian.garbaciak@diasemi.com \
--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