diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-09-04 17:17:46 +0530 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-17 00:28:43 +0100 |
commit | 9c7c9eae5f7ac57465c0ac6adc8e3ad3afad2544 (patch) | |
tree | 2e408c4101693dd15c977c38022c4a30074dadf0 /drivers/regulator/tps65023-regulator.c | |
parent | 58c6e938c00de744d52f739aa426a4b1b13ef22b (diff) | |
download | talos-obmc-linux-9c7c9eae5f7ac57465c0ac6adc8e3ad3afad2544.tar.gz talos-obmc-linux-9c7c9eae5f7ac57465c0ac6adc8e3ad3afad2544.zip |
regulator: tps65023: Use devm_regulator_register
devm_* simplifies the code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/tps65023-regulator.c')
-rw-r--r-- | drivers/regulator/tps65023-regulator.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index a15263d4bdff..a957579bd98b 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c @@ -277,12 +277,12 @@ static int tps_65023_probe(struct i2c_client *client, config.regmap = tps->regmap; /* Register the regulators */ - rdev = regulator_register(&tps->desc[i], &config); + rdev = devm_regulator_register(&client->dev, &tps->desc[i], + &config); if (IS_ERR(rdev)) { dev_err(&client->dev, "failed to register %s\n", id->name); - error = PTR_ERR(rdev); - goto fail; + return PTR_ERR(rdev); } /* Save regulator for cleanup */ @@ -296,21 +296,6 @@ static int tps_65023_probe(struct i2c_client *client, TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ); return 0; - - fail: - while (--i >= 0) - regulator_unregister(tps->rdev[i]); - return error; -} - -static int tps_65023_remove(struct i2c_client *client) -{ - struct tps_pmic *tps = i2c_get_clientdata(client); - int i; - - for (i = 0; i < TPS65023_NUM_REGULATOR; i++) - regulator_unregister(tps->rdev[i]); - return 0; } static const struct tps_info tps65020_regs[] = { @@ -430,7 +415,6 @@ static struct i2c_driver tps_65023_i2c_driver = { .owner = THIS_MODULE, }, .probe = tps_65023_probe, - .remove = tps_65023_remove, .id_table = tps_65023_id, }; |