aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/ab8500-ext.c33
-rw-r--r--drivers/regulator/ab8500.c17
2 files changed, 32 insertions, 18 deletions
diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
index e4975bc61e81..95f495f51d00 100644
--- a/drivers/regulator/ab8500-ext.c
+++ b/drivers/regulator/ab8500-ext.c
@@ -333,7 +333,7 @@ static struct ab8500_ext_regulator_info
333 }, 333 },
334}; 334};
335 335
336int ab8500_ext_regulator_init(struct platform_device *pdev) 336int ab8500_ext_regulator_probe(struct platform_device *pdev)
337{ 337{
338 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 338 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
339 struct ab8500_platform_data *ppdata; 339 struct ab8500_platform_data *ppdata;
@@ -409,7 +409,7 @@ int ab8500_ext_regulator_init(struct platform_device *pdev)
409 return 0; 409 return 0;
410} 410}
411 411
412void ab8500_ext_regulator_exit(struct platform_device *pdev) 412int ab8500_ext_regulator_remove(struct platform_device *pdev)
413{ 413{
414 int i; 414 int i;
415 415
@@ -422,7 +422,36 @@ void ab8500_ext_regulator_exit(struct platform_device *pdev)
422 422
423 regulator_unregister(info->rdev); 423 regulator_unregister(info->rdev);
424 } 424 }
425
426 return 0;
427}
428
429static struct platform_driver ab8500_ext_regulator_driver = {
430 .probe = ab8500_ext_regulator_probe,
431 .remove = ab8500_ext_regulator_remove,
432 .driver = {
433 .name = "ab8500-ext-regulator",
434 .owner = THIS_MODULE,
435 },
436};
437
438static int __init ab8500_ext_regulator_init(void)
439{
440 int ret;
441
442 ret = platform_driver_register(&ab8500_ext_regulator_driver);
443 if (ret)
444 pr_err("Failed to register ab8500 ext regulator: %d\n", ret);
445
446 return ret;
447}
448subsys_initcall(ab8500_ext_regulator_init);
449
450static void __exit ab8500_ext_regulator_exit(void)
451{
452 platform_driver_unregister(&ab8500_ext_regulator_driver);
425} 453}
454module_exit(ab8500_ext_regulator_exit);
426 455
427MODULE_LICENSE("GPL v2"); 456MODULE_LICENSE("GPL v2");
428MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>"); 457MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>");
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index f6656b8c28b6..dfc790196b34 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3156,22 +3156,12 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
3156 return err; 3156 return err;
3157 } 3157 }
3158 3158
3159 if (!is_ab8505(ab8500)) {
3160 /* register external regulators (before Vaux1, 2 and 3) */
3161 err = ab8500_ext_regulator_init(pdev);
3162 if (err)
3163 return err;
3164 }
3165
3166 /* register all regulators */ 3159 /* register all regulators */
3167 for (i = 0; i < abx500_regulator.info_size; i++) { 3160 for (i = 0; i < abx500_regulator.info_size; i++) {
3168 err = ab8500_regulator_register(pdev, &pdata->regulator[i], 3161 err = ab8500_regulator_register(pdev, &pdata->regulator[i],
3169 i, NULL); 3162 i, NULL);
3170 if (err < 0) { 3163 if (err < 0)
3171 if (!is_ab8505(ab8500))
3172 ab8500_ext_regulator_exit(pdev);
3173 return err; 3164 return err;
3174 }
3175 } 3165 }
3176 3166
3177 return 0; 3167 return 0;
@@ -3180,7 +3170,6 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
3180static int ab8500_regulator_remove(struct platform_device *pdev) 3170static int ab8500_regulator_remove(struct platform_device *pdev)
3181{ 3171{
3182 int i, err; 3172 int i, err;
3183 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3184 3173
3185 for (i = 0; i < abx500_regulator.info_size; i++) { 3174 for (i = 0; i < abx500_regulator.info_size; i++) {
3186 struct ab8500_regulator_info *info = NULL; 3175 struct ab8500_regulator_info *info = NULL;
@@ -3192,10 +3181,6 @@ static int ab8500_regulator_remove(struct platform_device *pdev)
3192 regulator_unregister(info->regulator); 3181 regulator_unregister(info->regulator);
3193 } 3182 }
3194 3183
3195 /* remove external regulators (after Vaux1, 2 and 3) */
3196 if (!is_ab8505(ab8500))
3197 ab8500_ext_regulator_exit(pdev);
3198
3199 /* remove regulator debug */ 3184 /* remove regulator debug */
3200 err = ab8500_regulator_debug_exit(pdev); 3185 err = ab8500_regulator_debug_exit(pdev);
3201 if (err) 3186 if (err)