mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 22:02:28 +00:00
regulator: tps6524x: use devm_regulator_register()
Use devm_regulator_register() to make cleanup paths simpler, and remove unnecessary remove(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
11c0da7bb4
commit
5e0855759c
@ -577,20 +577,6 @@ static struct regulator_ops regulator_ops = {
|
|||||||
.get_current_limit = get_current_limit,
|
.get_current_limit = get_current_limit,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pmic_remove(struct spi_device *spi)
|
|
||||||
{
|
|
||||||
struct tps6524x *hw = spi_get_drvdata(spi);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!hw)
|
|
||||||
return 0;
|
|
||||||
for (i = 0; i < N_REGULATORS; i++) {
|
|
||||||
regulator_unregister(hw->rdev[i]);
|
|
||||||
hw->rdev[i] = NULL;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pmic_probe(struct spi_device *spi)
|
static int pmic_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct tps6524x *hw;
|
struct tps6524x *hw;
|
||||||
@ -598,7 +584,7 @@ static int pmic_probe(struct spi_device *spi)
|
|||||||
const struct supply_info *info = supply_info;
|
const struct supply_info *info = supply_info;
|
||||||
struct regulator_init_data *init_data;
|
struct regulator_init_data *init_data;
|
||||||
struct regulator_config config = { };
|
struct regulator_config config = { };
|
||||||
int ret = 0, i;
|
int i;
|
||||||
|
|
||||||
init_data = dev_get_platdata(dev);
|
init_data = dev_get_platdata(dev);
|
||||||
if (!init_data) {
|
if (!init_data) {
|
||||||
@ -631,24 +617,17 @@ static int pmic_probe(struct spi_device *spi)
|
|||||||
config.init_data = init_data;
|
config.init_data = init_data;
|
||||||
config.driver_data = hw;
|
config.driver_data = hw;
|
||||||
|
|
||||||
hw->rdev[i] = regulator_register(&hw->desc[i], &config);
|
hw->rdev[i] = devm_regulator_register(dev, &hw->desc[i],
|
||||||
if (IS_ERR(hw->rdev[i])) {
|
&config);
|
||||||
ret = PTR_ERR(hw->rdev[i]);
|
if (IS_ERR(hw->rdev[i]))
|
||||||
hw->rdev[i] = NULL;
|
return PTR_ERR(hw->rdev[i]);
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
|
||||||
pmic_remove(spi);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct spi_driver pmic_driver = {
|
static struct spi_driver pmic_driver = {
|
||||||
.probe = pmic_probe,
|
.probe = pmic_probe,
|
||||||
.remove = pmic_remove,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "tps6524x",
|
.name = "tps6524x",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
Loading…
Reference in New Issue
Block a user