aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/88pm8607.c
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2010-04-29 13:33:50 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-05-25 05:16:02 -0400
commit192bbb95ca16f2b4d4383e76b3262672e6116daa (patch)
tree1e090809827018c4a7d4f9dfcd6a97e3ab08c106 /drivers/regulator/88pm8607.c
parentd4033b54fc91221b13e2850bf298683c0f2ff37d (diff)
regulator: make 88pm860x sharing one driver structure
Remove a lot of driver structures in 88pm860x driver. Make regulators share one driver structure. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/88pm8607.c')
-rw-r--r--drivers/regulator/88pm8607.c51
1 files changed, 10 insertions, 41 deletions
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index 5fb83e2ced25..121bab4c0dc0 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -484,60 +484,29 @@ static int __devexit pm8607_regulator_remove(struct platform_device *pdev)
484{ 484{
485 struct pm8607_regulator_info *info = platform_get_drvdata(pdev); 485 struct pm8607_regulator_info *info = platform_get_drvdata(pdev);
486 486
487 platform_set_drvdata(pdev, NULL);
487 regulator_unregister(info->regulator); 488 regulator_unregister(info->regulator);
488 return 0; 489 return 0;
489} 490}
490 491
491#define PM8607_REGULATOR_DRIVER(_name) \ 492static struct platform_driver pm8607_regulator_driver = {
492{ \ 493 .driver = {
493 .driver = { \ 494 .name = "88pm860x-regulator",
494 .name = "88pm8607-" #_name, \ 495 .owner = THIS_MODULE,
495 .owner = THIS_MODULE, \ 496 },
496 }, \ 497 .probe = pm8607_regulator_probe,
497 .probe = pm8607_regulator_probe, \ 498 .remove = __devexit_p(pm8607_regulator_remove),
498 .remove = __devexit_p(pm8607_regulator_remove), \
499}
500
501static struct platform_driver pm8607_regulator_driver[] = {
502 PM8607_REGULATOR_DRIVER(buck1),
503 PM8607_REGULATOR_DRIVER(buck2),
504 PM8607_REGULATOR_DRIVER(buck3),
505 PM8607_REGULATOR_DRIVER(ldo1),
506 PM8607_REGULATOR_DRIVER(ldo2),
507 PM8607_REGULATOR_DRIVER(ldo3),
508 PM8607_REGULATOR_DRIVER(ldo4),
509 PM8607_REGULATOR_DRIVER(ldo5),
510 PM8607_REGULATOR_DRIVER(ldo6),
511 PM8607_REGULATOR_DRIVER(ldo7),
512 PM8607_REGULATOR_DRIVER(ldo8),
513 PM8607_REGULATOR_DRIVER(ldo9),
514 PM8607_REGULATOR_DRIVER(ldo10),
515 PM8607_REGULATOR_DRIVER(ldo12),
516 PM8607_REGULATOR_DRIVER(ldo14),
517}; 499};
518 500
519static int __init pm8607_regulator_init(void) 501static int __init pm8607_regulator_init(void)
520{ 502{
521 int i, count, ret; 503 return platform_driver_register(&pm8607_regulator_driver);
522
523 count = ARRAY_SIZE(pm8607_regulator_driver);
524 for (i = 0; i < count; i++) {
525 ret = platform_driver_register(&pm8607_regulator_driver[i]);
526 if (ret != 0)
527 pr_err("Failed to register regulator driver: %d\n",
528 ret);
529 }
530 return 0;
531} 504}
532subsys_initcall(pm8607_regulator_init); 505subsys_initcall(pm8607_regulator_init);
533 506
534static void __exit pm8607_regulator_exit(void) 507static void __exit pm8607_regulator_exit(void)
535{ 508{
536 int i, count; 509 platform_driver_unregister(&pm8607_regulator_driver);
537
538 count = ARRAY_SIZE(pm8607_regulator_driver);
539 for (i = 0; i < count; i++)
540 platform_driver_unregister(&pm8607_regulator_driver[i]);
541} 510}
542module_exit(pm8607_regulator_exit); 511module_exit(pm8607_regulator_exit);
543 512