diff options
-rw-r--r-- | drivers/regulator/wm8400-regulator.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c index d9a2c988c6e7..924c7eb29ee9 100644 --- a/drivers/regulator/wm8400-regulator.c +++ b/drivers/regulator/wm8400-regulator.c | |||
@@ -317,14 +317,17 @@ static struct regulator_desc regulators[] = { | |||
317 | 317 | ||
318 | static int __devinit wm8400_regulator_probe(struct platform_device *pdev) | 318 | static int __devinit wm8400_regulator_probe(struct platform_device *pdev) |
319 | { | 319 | { |
320 | struct wm8400 *wm8400 = container_of(pdev, struct wm8400, regulators[pdev->id]); | ||
320 | struct regulator_dev *rdev; | 321 | struct regulator_dev *rdev; |
321 | 322 | ||
322 | rdev = regulator_register(®ulators[pdev->id], &pdev->dev, | 323 | rdev = regulator_register(®ulators[pdev->id], &pdev->dev, |
323 | pdev->dev.platform_data, dev_get_drvdata(&pdev->dev)); | 324 | pdev->dev.platform_data, wm8400); |
324 | 325 | ||
325 | if (IS_ERR(rdev)) | 326 | if (IS_ERR(rdev)) |
326 | return PTR_ERR(rdev); | 327 | return PTR_ERR(rdev); |
327 | 328 | ||
329 | platform_set_drvdata(pdev, rdev); | ||
330 | |||
328 | return 0; | 331 | return 0; |
329 | } | 332 | } |
330 | 333 | ||
@@ -332,6 +335,7 @@ static int __devexit wm8400_regulator_remove(struct platform_device *pdev) | |||
332 | { | 335 | { |
333 | struct regulator_dev *rdev = platform_get_drvdata(pdev); | 336 | struct regulator_dev *rdev = platform_get_drvdata(pdev); |
334 | 337 | ||
338 | platform_set_drvdata(pdev, NULL); | ||
335 | regulator_unregister(rdev); | 339 | regulator_unregister(rdev); |
336 | 340 | ||
337 | return 0; | 341 | return 0; |
@@ -370,7 +374,6 @@ int wm8400_register_regulator(struct device *dev, int reg, | |||
370 | wm8400->regulators[reg].id = reg; | 374 | wm8400->regulators[reg].id = reg; |
371 | wm8400->regulators[reg].dev.parent = dev; | 375 | wm8400->regulators[reg].dev.parent = dev; |
372 | wm8400->regulators[reg].dev.platform_data = initdata; | 376 | wm8400->regulators[reg].dev.platform_data = initdata; |
373 | dev_set_drvdata(&wm8400->regulators[reg].dev, wm8400); | ||
374 | 377 | ||
375 | return platform_device_register(&wm8400->regulators[reg]); | 378 | return platform_device_register(&wm8400->regulators[reg]); |
376 | } | 379 | } |