diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 13:19:10 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 13:19:10 -0800 |
commit | 15333539a9b3022656f815f643a77f6b054b335f (patch) | |
tree | 2c5eabbd1ba12a0bd33e8f10c32847f88567d681 /drivers/regulator/lp3971.c | |
parent | bb1b64908f5a346b0654f02999e1a022a7e0c07d (diff) | |
parent | 07b19808486054f356dbf3495a277f51af062b35 (diff) |
Merge tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"A respin of the merges in the previous pull request with one extra
fix.
A quiet release for the regulator API, quite a large number of small
improvements all over but other than the addition of new drivers for
the AS3722 and MAX14577 there is nothing of substantial non-local
impact"
* tag 'regulator-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (47 commits)
regulator: pfuze100-regulator: Improve dev_info() message
regulator: pfuze100-regulator: Fix some checkpatch complaints
regulator: twl: Fix checkpatch issue
regulator: core: Fix checkpatch issue
regulator: anatop-regulator: Remove unneeded memset()
regulator: s5m8767: Update LDO index in s5m8767-regulator.txt
regulator: as3722: set enable time for SD0/1/6
regulator: as3722: detect SD0 low-voltage mode
regulator: tps62360: Fix up a pointer-integer size mismatch warning
regulator: anatop-regulator: Remove unneeded kstrdup()
regulator: act8865: Fix build error when !OF
regulator: act8865: register all regulators regardless of how many are used
regulator: wm831x-dcdc: Remove unneeded 'err' label
regulator: anatop-regulator: Add MODULE_ALIAS()
regulator: act8865: fix incorrect devm_kzalloc for act8865
regulator: act8865: Remove set_suspend_[en|dis]able implementation
regulator: act8865: Remove unneeded regulator_unregister() calls
regulator: s2mps11: Clean up redundant code
regulator: tps65910: Simplify setting enable_mask for regulators
regulator: act8865: add device tree binding doc
...
Diffstat (limited to 'drivers/regulator/lp3971.c')
-rw-r--r-- | drivers/regulator/lp3971.c | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 947c05ffe0a..3b1102b7507 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -25,8 +25,6 @@ struct lp3971 { struct device *dev; struct mutex io_lock; struct i2c_client *i2c; - int num_regulators; - struct regulator_dev **rdev; }; static u8 lp3971_reg_read(struct lp3971 *lp3971, u8 reg); @@ -383,42 +381,27 @@ static int setup_regulators(struct lp3971 *lp3971, { int i, err; - lp3971->num_regulators = pdata->num_regulators; - lp3971->rdev = kcalloc(pdata->num_regulators, - sizeof(struct regulator_dev *), GFP_KERNEL); - if (!lp3971->rdev) { - err = -ENOMEM; - goto err_nomem; - } - /* Instantiate the regulators */ for (i = 0; i < pdata->num_regulators; i++) { struct regulator_config config = { }; struct lp3971_regulator_subdev *reg = &pdata->regulators[i]; + struct regulator_dev *rdev; config.dev = lp3971->dev; config.init_data = reg->initdata; config.driver_data = lp3971; - lp3971->rdev[i] = regulator_register(®ulators[reg->id], - &config); - if (IS_ERR(lp3971->rdev[i])) { - err = PTR_ERR(lp3971->rdev[i]); + rdev = devm_regulator_register(lp3971->dev, + ®ulators[reg->id], &config); + if (IS_ERR(rdev)) { + err = PTR_ERR(rdev); dev_err(lp3971->dev, "regulator init failed: %d\n", err); - goto error; + return err; } } return 0; - -error: - while (--i >= 0) - regulator_unregister(lp3971->rdev[i]); - kfree(lp3971->rdev); - lp3971->rdev = NULL; -err_nomem: - return err; } static int lp3971_i2c_probe(struct i2c_client *i2c, @@ -460,19 +443,6 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, return 0; } -static int lp3971_i2c_remove(struct i2c_client *i2c) -{ - struct lp3971 *lp3971 = i2c_get_clientdata(i2c); - int i; - - for (i = 0; i < lp3971->num_regulators; i++) - regulator_unregister(lp3971->rdev[i]); - - kfree(lp3971->rdev); - - return 0; -} - static const struct i2c_device_id lp3971_i2c_id[] = { { "lp3971", 0 }, { } @@ -485,7 +455,6 @@ static struct i2c_driver lp3971_i2c_driver = { .owner = THIS_MODULE, }, .probe = lp3971_i2c_probe, - .remove = lp3971_i2c_remove, .id_table = lp3971_i2c_id, }; |