aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-ldo.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-24 06:11:32 -0400
committerMark Brown <broonie@linaro.org>2013-10-24 06:11:32 -0400
commit420118d48311e0c4ef4aace5aede35079ecc2412 (patch)
treea4affbc11b9271d786b9c9e5711b1e7dc873d3e8 /drivers/regulator/wm831x-ldo.c
parent2a2bec6554e9e9d0ae351575ca1f72df1fa0f15f (diff)
parent32dadef2190efd2e06331825b11881daf100d6d9 (diff)
Merge remote-tracking branch 'regulator/topic/alias' into regulator-next
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r--drivers/regulator/wm831x-ldo.c63
1 files changed, 15 insertions, 48 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 2205fbc2c37b..482ebe8f47aa 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -279,7 +279,8 @@ static int wm831x_gp_ldo_probe(struct platform_device *pdev)
279 config.driver_data = ldo; 279 config.driver_data = ldo;
280 config.regmap = wm831x->regmap; 280 config.regmap = wm831x->regmap;
281 281
282 ldo->regulator = regulator_register(&ldo->desc, &config); 282 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc,
283 &config);
283 if (IS_ERR(ldo->regulator)) { 284 if (IS_ERR(ldo->regulator)) {
284 ret = PTR_ERR(ldo->regulator); 285 ret = PTR_ERR(ldo->regulator);
285 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 286 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -288,39 +289,26 @@ static int wm831x_gp_ldo_probe(struct platform_device *pdev)
288 } 289 }
289 290
290 irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 291 irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV"));
291 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, 292 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
292 IRQF_TRIGGER_RISING, ldo->name, 293 wm831x_ldo_uv_irq,
293 ldo); 294 IRQF_TRIGGER_RISING, ldo->name,
295 ldo);
294 if (ret != 0) { 296 if (ret != 0) {
295 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n", 297 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
296 irq, ret); 298 irq, ret);
297 goto err_regulator; 299 goto err;
298 } 300 }
299 301
300 platform_set_drvdata(pdev, ldo); 302 platform_set_drvdata(pdev, ldo);
301 303
302 return 0; 304 return 0;
303 305
304err_regulator:
305 regulator_unregister(ldo->regulator);
306err: 306err:
307 return ret; 307 return ret;
308} 308}
309 309
310static int wm831x_gp_ldo_remove(struct platform_device *pdev)
311{
312 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
313
314 free_irq(wm831x_irq(ldo->wm831x,
315 platform_get_irq_byname(pdev, "UV")), ldo);
316 regulator_unregister(ldo->regulator);
317
318 return 0;
319}
320
321static struct platform_driver wm831x_gp_ldo_driver = { 310static struct platform_driver wm831x_gp_ldo_driver = {
322 .probe = wm831x_gp_ldo_probe, 311 .probe = wm831x_gp_ldo_probe,
323 .remove = wm831x_gp_ldo_remove,
324 .driver = { 312 .driver = {
325 .name = "wm831x-ldo", 313 .name = "wm831x-ldo",
326 .owner = THIS_MODULE, 314 .owner = THIS_MODULE,
@@ -505,7 +493,8 @@ static int wm831x_aldo_probe(struct platform_device *pdev)
505 config.driver_data = ldo; 493 config.driver_data = ldo;
506 config.regmap = wm831x->regmap; 494 config.regmap = wm831x->regmap;
507 495
508 ldo->regulator = regulator_register(&ldo->desc, &config); 496 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc,
497 &config);
509 if (IS_ERR(ldo->regulator)) { 498 if (IS_ERR(ldo->regulator)) {
510 ret = PTR_ERR(ldo->regulator); 499 ret = PTR_ERR(ldo->regulator);
511 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 500 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -514,38 +503,25 @@ static int wm831x_aldo_probe(struct platform_device *pdev)
514 } 503 }
515 504
516 irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); 505 irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV"));
517 ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, 506 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
518 IRQF_TRIGGER_RISING, ldo->name, ldo); 507 wm831x_ldo_uv_irq,
508 IRQF_TRIGGER_RISING, ldo->name, ldo);
519 if (ret != 0) { 509 if (ret != 0) {
520 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n", 510 dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
521 irq, ret); 511 irq, ret);
522 goto err_regulator; 512 goto err;
523 } 513 }
524 514
525 platform_set_drvdata(pdev, ldo); 515 platform_set_drvdata(pdev, ldo);
526 516
527 return 0; 517 return 0;
528 518
529err_regulator:
530 regulator_unregister(ldo->regulator);
531err: 519err:
532 return ret; 520 return ret;
533} 521}
534 522
535static int wm831x_aldo_remove(struct platform_device *pdev)
536{
537 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
538
539 free_irq(wm831x_irq(ldo->wm831x, platform_get_irq_byname(pdev, "UV")),
540 ldo);
541 regulator_unregister(ldo->regulator);
542
543 return 0;
544}
545
546static struct platform_driver wm831x_aldo_driver = { 523static struct platform_driver wm831x_aldo_driver = {
547 .probe = wm831x_aldo_probe, 524 .probe = wm831x_aldo_probe,
548 .remove = wm831x_aldo_remove,
549 .driver = { 525 .driver = {
550 .name = "wm831x-aldo", 526 .name = "wm831x-aldo",
551 .owner = THIS_MODULE, 527 .owner = THIS_MODULE,
@@ -663,7 +639,8 @@ static int wm831x_alive_ldo_probe(struct platform_device *pdev)
663 config.driver_data = ldo; 639 config.driver_data = ldo;
664 config.regmap = wm831x->regmap; 640 config.regmap = wm831x->regmap;
665 641
666 ldo->regulator = regulator_register(&ldo->desc, &config); 642 ldo->regulator = devm_regulator_register(&pdev->dev, &ldo->desc,
643 &config);
667 if (IS_ERR(ldo->regulator)) { 644 if (IS_ERR(ldo->regulator)) {
668 ret = PTR_ERR(ldo->regulator); 645 ret = PTR_ERR(ldo->regulator);
669 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", 646 dev_err(wm831x->dev, "Failed to register LDO%d: %d\n",
@@ -679,18 +656,8 @@ err:
679 return ret; 656 return ret;
680} 657}
681 658
682static int wm831x_alive_ldo_remove(struct platform_device *pdev)
683{
684 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
685
686 regulator_unregister(ldo->regulator);
687
688 return 0;
689}
690
691static struct platform_driver wm831x_alive_ldo_driver = { 659static struct platform_driver wm831x_alive_ldo_driver = {
692 .probe = wm831x_alive_ldo_probe, 660 .probe = wm831x_alive_ldo_probe,
693 .remove = wm831x_alive_ldo_remove,
694 .driver = { 661 .driver = {
695 .name = "wm831x-alive-ldo", 662 .name = "wm831x-alive-ldo",
696 .owner = THIS_MODULE, 663 .owner = THIS_MODULE,