diff options
Diffstat (limited to 'drivers/regulator/s2mps11.c')
-rw-r--r-- | drivers/regulator/s2mps11.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 4669dc9ac74a..926f9c8f2fac 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/mfd/samsung/s2mps11.h> | 24 | #include <linux/mfd/samsung/s2mps11.h> |
25 | 25 | ||
26 | struct s2mps11_info { | 26 | struct s2mps11_info { |
27 | struct regulator_dev **rdev; | 27 | struct regulator_dev *rdev[S2MPS11_REGULATOR_MAX]; |
28 | 28 | ||
29 | int ramp_delay2; | 29 | int ramp_delay2; |
30 | int ramp_delay34; | 30 | int ramp_delay34; |
@@ -236,9 +236,8 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) | |||
236 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 236 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
237 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); | 237 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); |
238 | struct regulator_config config = { }; | 238 | struct regulator_config config = { }; |
239 | struct regulator_dev **rdev; | ||
240 | struct s2mps11_info *s2mps11; | 239 | struct s2mps11_info *s2mps11; |
241 | int i, ret, size; | 240 | int i, ret; |
242 | unsigned char ramp_enable, ramp_reg = 0; | 241 | unsigned char ramp_enable, ramp_reg = 0; |
243 | 242 | ||
244 | if (!pdata) { | 243 | if (!pdata) { |
@@ -251,13 +250,6 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) | |||
251 | if (!s2mps11) | 250 | if (!s2mps11) |
252 | return -ENOMEM; | 251 | return -ENOMEM; |
253 | 252 | ||
254 | size = sizeof(struct regulator_dev *) * S2MPS11_REGULATOR_MAX; | ||
255 | s2mps11->rdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); | ||
256 | if (!s2mps11->rdev) { | ||
257 | return -ENOMEM; | ||
258 | } | ||
259 | |||
260 | rdev = s2mps11->rdev; | ||
261 | platform_set_drvdata(pdev, s2mps11); | 253 | platform_set_drvdata(pdev, s2mps11); |
262 | 254 | ||
263 | s2mps11->ramp_delay2 = pdata->buck2_ramp_delay; | 255 | s2mps11->ramp_delay2 = pdata->buck2_ramp_delay; |
@@ -297,12 +289,12 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) | |||
297 | config.init_data = pdata->regulators[i].initdata; | 289 | config.init_data = pdata->regulators[i].initdata; |
298 | config.driver_data = s2mps11; | 290 | config.driver_data = s2mps11; |
299 | 291 | ||
300 | rdev[i] = regulator_register(®ulators[i], &config); | 292 | s2mps11->rdev[i] = regulator_register(®ulators[i], &config); |
301 | if (IS_ERR(rdev[i])) { | 293 | if (IS_ERR(s2mps11->rdev[i])) { |
302 | ret = PTR_ERR(rdev[i]); | 294 | ret = PTR_ERR(s2mps11->rdev[i]); |
303 | dev_err(&pdev->dev, "regulator init failed for %d\n", | 295 | dev_err(&pdev->dev, "regulator init failed for %d\n", |
304 | i); | 296 | i); |
305 | rdev[i] = NULL; | 297 | s2mps11->rdev[i] = NULL; |
306 | goto err; | 298 | goto err; |
307 | } | 299 | } |
308 | } | 300 | } |
@@ -310,8 +302,7 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) | |||
310 | return 0; | 302 | return 0; |
311 | err: | 303 | err: |
312 | for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) | 304 | for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) |
313 | if (rdev[i]) | 305 | regulator_unregister(s2mps11->rdev[i]); |
314 | regulator_unregister(rdev[i]); | ||
315 | 306 | ||
316 | return ret; | 307 | return ret; |
317 | } | 308 | } |
@@ -319,12 +310,10 @@ err: | |||
319 | static int __devexit s2mps11_pmic_remove(struct platform_device *pdev) | 310 | static int __devexit s2mps11_pmic_remove(struct platform_device *pdev) |
320 | { | 311 | { |
321 | struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev); | 312 | struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev); |
322 | struct regulator_dev **rdev = s2mps11->rdev; | ||
323 | int i; | 313 | int i; |
324 | 314 | ||
325 | for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) | 315 | for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) |
326 | if (rdev[i]) | 316 | regulator_unregister(s2mps11->rdev[i]); |
327 | regulator_unregister(rdev[i]); | ||
328 | 317 | ||
329 | return 0; | 318 | return 0; |
330 | } | 319 | } |