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/max8998.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/regulator/max8998.c')
-rw-r--r-- | drivers/regulator/max8998.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index ae3f065..a4c53b2 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -790,14 +790,16 @@ static int max8998_pmic_probe(struct platform_device *pdev) dev_err(&pdev->dev, "MAX8998 SET1 GPIO defined as 0 !\n"); WARN_ON(!pdata->buck1_set1); - return -EIO; + ret = -EIO; + goto err_out; } /* Check if SET2 is not equal to 0 */ if (!pdata->buck1_set2) { dev_err(&pdev->dev, "MAX8998 SET2 GPIO defined as 0 !\n"); WARN_ON(!pdata->buck1_set2); - return -EIO; + ret = -EIO; + goto err_out; } gpio_request(pdata->buck1_set1, "MAX8998 BUCK1_SET1"); @@ -821,7 +823,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1 + v, i); if (ret) - return ret; + goto err_out; } } @@ -831,7 +833,8 @@ static int max8998_pmic_probe(struct platform_device *pdev) dev_err(&pdev->dev, "MAX8998 SET3 GPIO defined as 0 !\n"); WARN_ON(!pdata->buck2_set3); - return -EIO; + ret = -EIO; + goto err_out; } gpio_request(pdata->buck2_set3, "MAX8998 BUCK2_SET3"); gpio_direction_output(pdata->buck2_set3, @@ -849,7 +852,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1 + v, i); if (ret) - return ret; + goto err_out; } } @@ -872,19 +875,34 @@ static int max8998_pmic_probe(struct platform_device *pdev) config.init_data = pdata->regulators[i].initdata; config.driver_data = max8998; - rdev[i] = devm_regulator_register(&pdev->dev, - ®ulators[index], &config); + rdev[i] = regulator_register(®ulators[index], &config); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); dev_err(max8998->dev, "regulator %s init failed (%d)\n", regulators[index].name, ret); rdev[i] = NULL; - return ret; + goto err; } } return 0; +err: + while (--i >= 0) + regulator_unregister(rdev[i]); +err_out: + return ret; +} + +static int max8998_pmic_remove(struct platform_device *pdev) +{ + struct max8998_data *max8998 = platform_get_drvdata(pdev); + struct regulator_dev **rdev = max8998->rdev; + int i; + + for (i = 0; i < max8998->num_regulators; i++) + regulator_unregister(rdev[i]); + return 0; } static const struct platform_device_id max8998_pmic_id[] = { @@ -900,6 +918,7 @@ static struct platform_driver max8998_pmic_driver = { .owner = THIS_MODULE, }, .probe = max8998_pmic_probe, + .remove = max8998_pmic_remove, .id_table = max8998_pmic_id, }; |