diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-03-10 04:32:46 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-10 05:31:56 -0400 |
commit | 640c24a77b5691b5fe802b6f51fb4e2ae1bee846 (patch) | |
tree | 2807a9296a69411ce350838de73fca60b6dcf96b /drivers/regulator/max77693.c | |
parent | d9aa5c56317ee15ff7116ae05de7811f2fee5a46 (diff) |
regulator: max77693: Remove state container as it is not needed
Don't store pointers to regulator_dev returned by
devm_regulator_register() in allocated memory in state container. They
aren't used anywhere outside of max77693_pmic_probe() function.
This change allows removing completely the 'struct max77693_pmic_dev'
state container as none of its fields are used outside of probe.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/max77693.c')
-rw-r--r-- | drivers/regulator/max77693.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c index d6807fd7eadc..653a58b49cdf 100644 --- a/drivers/regulator/max77693.c +++ b/drivers/regulator/max77693.c | |||
@@ -34,13 +34,6 @@ | |||
34 | 34 | ||
35 | #define CHGIN_ILIM_STEP_20mA 20000 | 35 | #define CHGIN_ILIM_STEP_20mA 20000 |
36 | 36 | ||
37 | struct max77693_pmic_dev { | ||
38 | struct device *dev; | ||
39 | struct max77693_dev *iodev; | ||
40 | int num_regulators; | ||
41 | struct regulator_dev **rdev; | ||
42 | }; | ||
43 | |||
44 | /* CHARGER regulator ops */ | 37 | /* CHARGER regulator ops */ |
45 | /* CHARGER regulator uses two bits for enabling */ | 38 | /* CHARGER regulator uses two bits for enabling */ |
46 | static int max77693_chg_is_enabled(struct regulator_dev *rdev) | 39 | static int max77693_chg_is_enabled(struct regulator_dev *rdev) |
@@ -232,7 +225,6 @@ static int max77693_pmic_init_rdata(struct device *dev, | |||
232 | static int max77693_pmic_probe(struct platform_device *pdev) | 225 | static int max77693_pmic_probe(struct platform_device *pdev) |
233 | { | 226 | { |
234 | struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 227 | struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
235 | struct max77693_pmic_dev *max77693_pmic; | ||
236 | struct max77693_regulator_data *rdata = NULL; | 228 | struct max77693_regulator_data *rdata = NULL; |
237 | int num_rdata, i; | 229 | int num_rdata, i; |
238 | struct regulator_config config; | 230 | struct regulator_config config; |
@@ -243,39 +235,22 @@ static int max77693_pmic_probe(struct platform_device *pdev) | |||
243 | return -ENODEV; | 235 | return -ENODEV; |
244 | } | 236 | } |
245 | 237 | ||
246 | max77693_pmic = devm_kzalloc(&pdev->dev, | ||
247 | sizeof(struct max77693_pmic_dev), | ||
248 | GFP_KERNEL); | ||
249 | if (!max77693_pmic) | ||
250 | return -ENOMEM; | ||
251 | |||
252 | max77693_pmic->rdev = devm_kzalloc(&pdev->dev, | ||
253 | sizeof(struct regulator_dev *) * num_rdata, | ||
254 | GFP_KERNEL); | ||
255 | if (!max77693_pmic->rdev) | ||
256 | return -ENOMEM; | ||
257 | |||
258 | max77693_pmic->dev = &pdev->dev; | ||
259 | max77693_pmic->iodev = iodev; | ||
260 | max77693_pmic->num_regulators = num_rdata; | ||
261 | |||
262 | config.dev = &pdev->dev; | 238 | config.dev = &pdev->dev; |
263 | config.regmap = iodev->regmap; | 239 | config.regmap = iodev->regmap; |
264 | config.driver_data = max77693_pmic; | ||
265 | platform_set_drvdata(pdev, max77693_pmic); | ||
266 | 240 | ||
267 | for (i = 0; i < max77693_pmic->num_regulators; i++) { | 241 | for (i = 0; i < num_rdata; i++) { |
268 | int id = rdata[i].id; | 242 | int id = rdata[i].id; |
243 | struct regulator_dev *rdev; | ||
269 | 244 | ||
270 | config.init_data = rdata[i].initdata; | 245 | config.init_data = rdata[i].initdata; |
271 | config.of_node = rdata[i].of_node; | 246 | config.of_node = rdata[i].of_node; |
272 | 247 | ||
273 | max77693_pmic->rdev[i] = devm_regulator_register(&pdev->dev, | 248 | rdev = devm_regulator_register(&pdev->dev, |
274 | ®ulators[id], &config); | 249 | ®ulators[id], &config); |
275 | if (IS_ERR(max77693_pmic->rdev[i])) { | 250 | if (IS_ERR(rdev)) { |
276 | dev_err(max77693_pmic->dev, | 251 | dev_err(&pdev->dev, |
277 | "Failed to initialize regulator-%d\n", id); | 252 | "Failed to initialize regulator-%d\n", id); |
278 | return PTR_ERR(max77693_pmic->rdev[i]); | 253 | return PTR_ERR(rdev); |
279 | } | 254 | } |
280 | } | 255 | } |
281 | 256 | ||