diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-03-09 03:32:19 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-10 06:12:13 -0400 |
commit | 8a221df6996f296aba4d4d713a42799bb28fde69 (patch) | |
tree | bc626a5bdaef088f439edf073720342a553119cb | |
parent | 58c9537791018f1cbe1c2b46128207758dce3745 (diff) |
regulator: max8998: Remove unnecessary **rdev from struct max8998_data
Now we are using devm_regulator_register(), so we don't need to allocate *rdev[]
array to store return value of devm_regulator_register. Use a *rdev variable is
enough for checking return status.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/max8998.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index ce22d4f3f3eb..961091b46557 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -40,7 +40,6 @@ struct max8998_data { | |||
40 | struct device *dev; | 40 | struct device *dev; |
41 | struct max8998_dev *iodev; | 41 | struct max8998_dev *iodev; |
42 | int num_regulators; | 42 | int num_regulators; |
43 | struct regulator_dev **rdev; | ||
44 | u8 buck1_vol[4]; /* voltages for selection */ | 43 | u8 buck1_vol[4]; /* voltages for selection */ |
45 | u8 buck2_vol[2]; | 44 | u8 buck2_vol[2]; |
46 | unsigned int buck1_idx; /* index to last changed voltage */ | 45 | unsigned int buck1_idx; /* index to last changed voltage */ |
@@ -746,10 +745,10 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
746 | struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 745 | struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
747 | struct max8998_platform_data *pdata = iodev->pdata; | 746 | struct max8998_platform_data *pdata = iodev->pdata; |
748 | struct regulator_config config = { }; | 747 | struct regulator_config config = { }; |
749 | struct regulator_dev **rdev; | 748 | struct regulator_dev *rdev; |
750 | struct max8998_data *max8998; | 749 | struct max8998_data *max8998; |
751 | struct i2c_client *i2c; | 750 | struct i2c_client *i2c; |
752 | int i, ret, size; | 751 | int i, ret; |
753 | unsigned int v; | 752 | unsigned int v; |
754 | 753 | ||
755 | if (!pdata) { | 754 | if (!pdata) { |
@@ -768,12 +767,6 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
768 | if (!max8998) | 767 | if (!max8998) |
769 | return -ENOMEM; | 768 | return -ENOMEM; |
770 | 769 | ||
771 | size = sizeof(struct regulator_dev *) * pdata->num_regulators; | ||
772 | max8998->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); | ||
773 | if (!max8998->rdev) | ||
774 | return -ENOMEM; | ||
775 | |||
776 | rdev = max8998->rdev; | ||
777 | max8998->dev = &pdev->dev; | 770 | max8998->dev = &pdev->dev; |
778 | max8998->iodev = iodev; | 771 | max8998->iodev = iodev; |
779 | max8998->num_regulators = pdata->num_regulators; | 772 | max8998->num_regulators = pdata->num_regulators; |
@@ -877,13 +870,12 @@ static int max8998_pmic_probe(struct platform_device *pdev) | |||
877 | config.init_data = pdata->regulators[i].initdata; | 870 | config.init_data = pdata->regulators[i].initdata; |
878 | config.driver_data = max8998; | 871 | config.driver_data = max8998; |
879 | 872 | ||
880 | rdev[i] = devm_regulator_register(&pdev->dev, | 873 | rdev = devm_regulator_register(&pdev->dev, ®ulators[index], |
881 | ®ulators[index], &config); | 874 | &config); |
882 | if (IS_ERR(rdev[i])) { | 875 | if (IS_ERR(rdev)) { |
883 | ret = PTR_ERR(rdev[i]); | 876 | ret = PTR_ERR(rdev); |
884 | dev_err(max8998->dev, "regulator %s init failed (%d)\n", | 877 | dev_err(max8998->dev, "regulator %s init failed (%d)\n", |
885 | regulators[index].name, ret); | 878 | regulators[index].name, ret); |
886 | rdev[i] = NULL; | ||
887 | return ret; | 879 | return ret; |
888 | } | 880 | } |
889 | } | 881 | } |