diff options
author | Mark Brown <broonie@linaro.org> | 2013-10-24 14:11:32 +0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-10-24 14:11:32 +0400 |
commit | 420118d48311e0c4ef4aace5aede35079ecc2412 (patch) | |
tree | a4affbc11b9271d786b9c9e5711b1e7dc873d3e8 /drivers/regulator/max8997.c | |
parent | 2a2bec6554e9e9d0ae351575ca1f72df1fa0f15f (diff) | |
parent | 32dadef2190efd2e06331825b11881daf100d6d9 (diff) | |
download | linux-420118d48311e0c4ef4aace5aede35079ecc2412.tar.xz |
Merge remote-tracking branch 'regulator/topic/alias' into regulator-next
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index df20069f0537..bcd2488d1252 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c @@ -1081,7 +1081,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) pdata->buck1_voltage[i] + buck1245_voltage_map_desc.step); if (ret < 0) - goto err_out; + return ret; max8997->buck2_vol[i] = ret = max8997_get_voltage_proper_val( @@ -1090,7 +1090,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) pdata->buck2_voltage[i] + buck1245_voltage_map_desc.step); if (ret < 0) - goto err_out; + return ret; max8997->buck5_vol[i] = ret = max8997_get_voltage_proper_val( @@ -1099,7 +1099,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) pdata->buck5_voltage[i] + buck1245_voltage_map_desc.step); if (ret < 0) - goto err_out; + return ret; if (max_buck1 < max8997->buck1_vol[i]) max_buck1 = max8997->buck1_vol[i]; @@ -1143,24 +1143,23 @@ static int max8997_pmic_probe(struct platform_device *pdev) !gpio_is_valid(pdata->buck125_gpios[1]) || !gpio_is_valid(pdata->buck125_gpios[2])) { dev_err(&pdev->dev, "GPIO NOT VALID\n"); - ret = -EINVAL; - goto err_out; + return -EINVAL; } ret = devm_gpio_request(&pdev->dev, pdata->buck125_gpios[0], "MAX8997 SET1"); if (ret) - goto err_out; + return ret; ret = devm_gpio_request(&pdev->dev, pdata->buck125_gpios[1], "MAX8997 SET2"); if (ret) - goto err_out; + return ret; ret = devm_gpio_request(&pdev->dev, pdata->buck125_gpios[2], "MAX8997 SET3"); if (ret) - goto err_out; + return ret; gpio_direction_output(pdata->buck125_gpios[0], (max8997->buck125_gpioindex >> 2) @@ -1205,33 +1204,16 @@ static int max8997_pmic_probe(struct platform_device *pdev) config.driver_data = max8997; config.of_node = pdata->regulators[i].reg_node; - rdev[i] = regulator_register(®ulators[id], &config); + rdev[i] = devm_regulator_register(&pdev->dev, ®ulators[id], + &config); if (IS_ERR(rdev[i])) { - ret = PTR_ERR(rdev[i]); dev_err(max8997->dev, "regulator init failed for %d\n", id); - rdev[i] = NULL; - goto err; + return PTR_ERR(rdev[i]); } } return 0; -err: - while (--i >= 0) - regulator_unregister(rdev[i]); -err_out: - return ret; -} - -static int max8997_pmic_remove(struct platform_device *pdev) -{ - struct max8997_data *max8997 = platform_get_drvdata(pdev); - struct regulator_dev **rdev = max8997->rdev; - int i; - - for (i = 0; i < max8997->num_regulators; i++) - regulator_unregister(rdev[i]); - return 0; } static const struct platform_device_id max8997_pmic_id[] = { @@ -1246,7 +1228,6 @@ static struct platform_driver max8997_pmic_driver = { .owner = THIS_MODULE, }, .probe = max8997_pmic_probe, - .remove = max8997_pmic_remove, .id_table = max8997_pmic_id, }; |