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 09/10] regulator: tps65912: Use devm_regulator_register
Date: Wed, 4 Sep 2013 17:17:52 +0530 [thread overview]
Message-ID: <1378295273-32257-9-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/tps65912-regulator.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 17e994e..3301af8 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -468,7 +468,7 @@ static int tps65912_probe(struct platform_device *pdev)
struct regulator_dev *rdev;
struct tps65912_reg *pmic;
struct tps65912_board *pmic_plat_data;
- int i, err;
+ int i;
pmic_plat_data = dev_get_platdata(tps65912->dev);
if (!pmic_plat_data)
@@ -505,34 +505,19 @@ static int tps65912_probe(struct platform_device *pdev)
config.init_data = reg_data;
config.driver_data = pmic;
- rdev = regulator_register(&pmic->desc[i], &config);
+ rdev = devm_regulator_register(&pdev->dev, &pmic->desc[i],
+ &config);
if (IS_ERR(rdev)) {
dev_err(tps65912->dev,
"failed to register %s regulator\n",
pdev->name);
- err = PTR_ERR(rdev);
- goto err;
+ return PTR_ERR(rdev);
}
/* Save regulator for cleanup */
pmic->rdev[i] = rdev;
}
return 0;
-
-err:
- while (--i >= 0)
- regulator_unregister(pmic->rdev[i]);
- return err;
-}
-
-static int tps65912_remove(struct platform_device *pdev)
-{
- struct tps65912_reg *tps65912_reg = platform_get_drvdata(pdev);
- int i;
-
- for (i = 0; i < TPS65912_NUM_REGULATOR; i++)
- regulator_unregister(tps65912_reg->rdev[i]);
- return 0;
}
static struct platform_driver tps65912_driver = {
@@ -541,7 +526,6 @@ static struct platform_driver tps65912_driver = {
.owner = THIS_MODULE,
},
.probe = tps65912_probe,
- .remove = tps65912_remove,
};
static int __init tps65912_init(void)
--
1.7.9.5
next prev parent reply other threads:[~2013-09-04 12:06 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 ` [PATCH 04/10] regulator: tps6507x: " Sachin Kamat
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 ` Sachin Kamat [this message]
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-9-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®