aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2013-09-04 07:47:46 -0400
committerMark Brown <broonie@linaro.org>2013-09-16 19:28:43 -0400
commit9c7c9eae5f7ac57465c0ac6adc8e3ad3afad2544 (patch)
tree2e408c4101693dd15c977c38022c4a30074dadf0
parent58c6e938c00de744d52f739aa426a4b1b13ef22b (diff)
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>
-rw-r--r--drivers/regulator/tps65023-regulator.c22
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,
277 config.regmap = tps->regmap; 277 config.regmap = tps->regmap;
278 278
279 /* Register the regulators */ 279 /* Register the regulators */
280 rdev = regulator_register(&tps->desc[i], &config); 280 rdev = devm_regulator_register(&client->dev, &tps->desc[i],
281 &config);
281 if (IS_ERR(rdev)) { 282 if (IS_ERR(rdev)) {
282 dev_err(&client->dev, "failed to register %s\n", 283 dev_err(&client->dev, "failed to register %s\n",
283 id->name); 284 id->name);
284 error = PTR_ERR(rdev); 285 return PTR_ERR(rdev);
285 goto fail;
286 } 286 }
287 287
288 /* Save regulator for cleanup */ 288 /* Save regulator for cleanup */
@@ -296,21 +296,6 @@ static int tps_65023_probe(struct i2c_client *client,
296 TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ); 296 TPS65023_REG_CTRL2_CORE_ADJ, TPS65023_REG_CTRL2_CORE_ADJ);
297 297
298 return 0; 298 return 0;
299
300 fail:
301 while (--i >= 0)
302 regulator_unregister(tps->rdev[i]);
303 return error;
304}
305
306static int tps_65023_remove(struct i2c_client *client)
307{
308 struct tps_pmic *tps = i2c_get_clientdata(client);
309 int i;
310
311 for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
312 regulator_unregister(tps->rdev[i]);
313 return 0;
314} 299}
315 300
316static const struct tps_info tps65020_regs[] = { 301static const struct tps_info tps65020_regs[] = {
@@ -430,7 +415,6 @@ static struct i2c_driver tps_65023_i2c_driver = {
430 .owner = THIS_MODULE, 415 .owner = THIS_MODULE,
431 }, 416 },
432 .probe = tps_65023_probe, 417 .probe = tps_65023_probe,
433 .remove = tps_65023_remove,
434 .id_table = tps_65023_id, 418 .id_table = tps_65023_id,
435}; 419};
436 420