diff options
-rw-r--r-- | drivers/regulator/ab8500-ext.c | 33 | ||||
-rw-r--r-- | drivers/regulator/ab8500.c | 17 | ||||
-rw-r--r-- | include/linux/regulator/ab8500.h | 4 |
3 files changed, 32 insertions, 22 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 | ||
336 | int ab8500_ext_regulator_init(struct platform_device *pdev) | 336 | int 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 | ||
412 | void ab8500_ext_regulator_exit(struct platform_device *pdev) | 412 | int 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 | |||
429 | static 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 | |||
438 | static 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 | } | ||
448 | subsys_initcall(ab8500_ext_regulator_init); | ||
449 | |||
450 | static void __exit ab8500_ext_regulator_exit(void) | ||
451 | { | ||
452 | platform_driver_unregister(&ab8500_ext_regulator_driver); | ||
425 | } | 453 | } |
454 | module_exit(ab8500_ext_regulator_exit); | ||
426 | 455 | ||
427 | MODULE_LICENSE("GPL v2"); | 456 | MODULE_LICENSE("GPL v2"); |
428 | MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com>"); | 457 | MODULE_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) | |||
3180 | static int ab8500_regulator_remove(struct platform_device *pdev) | 3170 | static 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) |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 7c5ff0c55773..75307447cef9 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
@@ -336,8 +336,4 @@ static inline int ab8500_regulator_debug_exit(struct platform_device *pdev) | |||
336 | } | 336 | } |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | /* AB8500 external regulator functions. */ | ||
340 | int ab8500_ext_regulator_init(struct platform_device *pdev); | ||
341 | void ab8500_ext_regulator_exit(struct platform_device *pdev); | ||
342 | |||
343 | #endif | 339 | #endif |