aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8660.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-03-10 05:37:19 -0400
committerMark Brown <broonie@linaro.org>2014-03-10 05:46:28 -0400
commit67f76a935f303a82fa94b5bdc0af3cbb7d4971f9 (patch)
tree0d65dea27b6a983d4905258d9cd61154ed9942fc /drivers/regulator/max8660.c
parentcde248f92fea058bdc8be33f39c04e0651b5036e (diff)
regulator: max8660: Remove regulator_dev pointer from state container
Don't store pointer to regulator_dev returned by devm_regulator_register() in state container. It isn't used anywhere outside of max8660_probe() function. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max8660.c')
-rw-r--r--drivers/regulator/max8660.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
index 61ecd0892637..bbbe53b1b5bf 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -81,7 +81,6 @@ enum {
81struct max8660 { 81struct max8660 {
82 struct i2c_client *client; 82 struct i2c_client *client;
83 u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */ 83 u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */
84 struct regulator_dev *rdev[];
85}; 84};
86 85
87static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val) 86static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
@@ -374,7 +373,6 @@ static inline int max8660_pdata_from_dt(struct device *dev,
374static int max8660_probe(struct i2c_client *client, 373static int max8660_probe(struct i2c_client *client,
375 const struct i2c_device_id *i2c_id) 374 const struct i2c_device_id *i2c_id)
376{ 375{
377 struct regulator_dev **rdev;
378 struct device *dev = &client->dev; 376 struct device *dev = &client->dev;
379 struct max8660_platform_data *pdata = dev_get_platdata(dev); 377 struct max8660_platform_data *pdata = dev_get_platdata(dev);
380 struct regulator_config config = { }; 378 struct regulator_config config = { };
@@ -407,14 +405,11 @@ static int max8660_probe(struct i2c_client *client,
407 return -EINVAL; 405 return -EINVAL;
408 } 406 }
409 407
410 max8660 = devm_kzalloc(dev, sizeof(struct max8660) + 408 max8660 = devm_kzalloc(dev, sizeof(struct max8660), GFP_KERNEL);
411 sizeof(struct regulator_dev *) * MAX8660_V_END,
412 GFP_KERNEL);
413 if (!max8660) 409 if (!max8660)
414 return -ENOMEM; 410 return -ENOMEM;
415 411
416 max8660->client = client; 412 max8660->client = client;
417 rdev = max8660->rdev;
418 413
419 if (pdata->en34_is_high) { 414 if (pdata->en34_is_high) {
420 /* Simulate always on */ 415 /* Simulate always on */
@@ -482,6 +477,7 @@ static int max8660_probe(struct i2c_client *client,
482 477
483 /* Finally register devices */ 478 /* Finally register devices */
484 for (i = 0; i < pdata->num_subdevs; i++) { 479 for (i = 0; i < pdata->num_subdevs; i++) {
480 struct regulator_dev *rdev;
485 481
486 id = pdata->subdevs[i].id; 482 id = pdata->subdevs[i].id;
487 483
@@ -490,13 +486,13 @@ static int max8660_probe(struct i2c_client *client,
490 config.of_node = of_node[i]; 486 config.of_node = of_node[i];
491 config.driver_data = max8660; 487 config.driver_data = max8660;
492 488
493 rdev[i] = devm_regulator_register(&client->dev, 489 rdev = devm_regulator_register(&client->dev,
494 &max8660_reg[id], &config); 490 &max8660_reg[id], &config);
495 if (IS_ERR(rdev[i])) { 491 if (IS_ERR(rdev)) {
496 ret = PTR_ERR(rdev[i]); 492 ret = PTR_ERR(rdev);
497 dev_err(&client->dev, "failed to register %s\n", 493 dev_err(&client->dev, "failed to register %s\n",
498 max8660_reg[id].name); 494 max8660_reg[id].name);
499 return PTR_ERR(rdev[i]); 495 return PTR_ERR(rdev);
500 } 496 }
501 } 497 }
502 498