diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/regulator/tps80031-regulator.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/tps80031-regulator.c')
-rw-r--r-- | drivers/regulator/tps80031-regulator.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c index 71f457a..6511d0b 100644 --- a/drivers/regulator/tps80031-regulator.c +++ b/drivers/regulator/tps80031-regulator.c @@ -719,7 +719,7 @@ static int tps80031_regulator_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "regulator config failed, e %d\n", ret); - return ret; + goto fail; } ret = tps80031_power_req_config(pdev->dev.parent, @@ -727,22 +727,41 @@ static int tps80031_regulator_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "pwr_req config failed, err %d\n", ret); - return ret; + goto fail; } } - rdev = devm_regulator_register(&pdev->dev, &ri->rinfo->desc, - &config); + rdev = regulator_register(&ri->rinfo->desc, &config); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "register regulator failed %s\n", ri->rinfo->desc.name); - return PTR_ERR(rdev); + ret = PTR_ERR(rdev); + goto fail; } ri->rdev = rdev; } platform_set_drvdata(pdev, pmic); return 0; +fail: + while (--num >= 0) { + ri = &pmic[num]; + regulator_unregister(ri->rdev); + } + return ret; +} + +static int tps80031_regulator_remove(struct platform_device *pdev) +{ + struct tps80031_regulator *pmic = platform_get_drvdata(pdev); + struct tps80031_regulator *ri = NULL; + int num; + + for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { + ri = &pmic[num]; + regulator_unregister(ri->rdev); + } + return 0; } static struct platform_driver tps80031_regulator_driver = { @@ -751,6 +770,7 @@ static struct platform_driver tps80031_regulator_driver = { .owner = THIS_MODULE, }, .probe = tps80031_regulator_probe, + .remove = tps80031_regulator_remove, }; static int __init tps80031_regulator_init(void) |