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/ab8500-ext.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/ab8500-ext.c')
-rw-r--r-- | drivers/regulator/ab8500-ext.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c index 29c0faa..02ff691 100644 --- a/drivers/regulator/ab8500-ext.c +++ b/drivers/regulator/ab8500-ext.c @@ -413,12 +413,16 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) &pdata->ext_regulator[i]; /* register regulator with framework */ - info->rdev = devm_regulator_register(&pdev->dev, &info->desc, - &config); + info->rdev = regulator_register(&info->desc, &config); if (IS_ERR(info->rdev)) { err = PTR_ERR(info->rdev); dev_err(&pdev->dev, "failed to register regulator %s\n", info->desc.name); + /* when we fail, un-register all earlier regulators */ + while (--i >= 0) { + info = &ab8500_ext_regulator_info[i]; + regulator_unregister(info->rdev); + } return err; } @@ -429,8 +433,26 @@ static int ab8500_ext_regulator_probe(struct platform_device *pdev) return 0; } +static int ab8500_ext_regulator_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ab8500_ext_regulator_info); i++) { + struct ab8500_ext_regulator_info *info = NULL; + info = &ab8500_ext_regulator_info[i]; + + dev_vdbg(rdev_get_dev(info->rdev), + "%s-remove\n", info->desc.name); + + regulator_unregister(info->rdev); + } + + return 0; +} + static struct platform_driver ab8500_ext_regulator_driver = { .probe = ab8500_ext_regulator_probe, + .remove = ab8500_ext_regulator_remove, .driver = { .name = "ab8500-ext-regulator", .owner = THIS_MODULE, |