summaryrefslogtreecommitdiff
path: root/drivers/regulator/tps6586x-regulator.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/regulator/tps6586x-regulator.c
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/tps6586x-regulator.c')
-rw-r--r--drivers/regulator/tps6586x-regulator.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index e8e3a8a..2c9155b 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -298,7 +298,7 @@ static struct tps6586x_platform_data *tps6586x_parse_regulator_dt(
struct tps6586x_platform_data *pdata;
int err;
- regs = of_get_child_by_name(np, "regulators");
+ regs = of_find_node_by_name(np, "regulators");
if (!regs) {
dev_err(&pdev->dev, "regulator node not found\n");
return NULL;
@@ -379,14 +379,15 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
ri = find_regulator_info(id);
if (!ri) {
dev_err(&pdev->dev, "invalid regulator ID specified\n");
- return -EINVAL;
+ err = -EINVAL;
+ goto fail;
}
err = tps6586x_regulator_preinit(pdev->dev.parent, ri);
if (err) {
dev_err(&pdev->dev,
"regulator %d preinit failed, e %d\n", id, err);
- return err;
+ goto fail;
}
config.dev = pdev->dev.parent;
@@ -396,12 +397,12 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
if (tps6586x_reg_matches)
config.of_node = tps6586x_reg_matches[id].of_node;
- rdev[id] = devm_regulator_register(&pdev->dev, &ri->desc,
- &config);
+ rdev[id] = regulator_register(&ri->desc, &config);
if (IS_ERR(rdev[id])) {
dev_err(&pdev->dev, "failed to register regulator %s\n",
ri->desc.name);
- return PTR_ERR(rdev[id]);
+ err = PTR_ERR(rdev[id]);
+ goto fail;
}
if (reg_data) {
@@ -410,13 +411,30 @@ static int tps6586x_regulator_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(&pdev->dev,
"Slew rate config failed, e %d\n", err);
- return err;
+ regulator_unregister(rdev[id]);
+ goto fail;
}
}
}
platform_set_drvdata(pdev, rdev);
return 0;
+
+fail:
+ while (--id >= 0)
+ regulator_unregister(rdev[id]);
+ return err;
+}
+
+static int tps6586x_regulator_remove(struct platform_device *pdev)
+{
+ struct regulator_dev **rdev = platform_get_drvdata(pdev);
+ int id = TPS6586X_ID_MAX_REGULATOR;
+
+ while (--id >= 0)
+ regulator_unregister(rdev[id]);
+
+ return 0;
}
static struct platform_driver tps6586x_regulator_driver = {
@@ -425,6 +443,7 @@ static struct platform_driver tps6586x_regulator_driver = {
.owner = THIS_MODULE,
},
.probe = tps6586x_regulator_probe,
+ .remove = tps6586x_regulator_remove,
};
static int __init tps6586x_regulator_init(void)