aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ab8500.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/ab8500.c')
-rw-r--r--drivers/regulator/ab8500.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c625468c7f2c..1fda14e12ea8 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -3037,28 +3037,12 @@ static int ab8500_regulator_register(struct platform_device *pdev,
3037 return 0; 3037 return 0;
3038} 3038}
3039 3039
3040static int
3041ab8500_regulator_of_probe(struct platform_device *pdev,
3042 struct device_node *np)
3043{
3044 struct of_regulator_match *match = abx500_regulator.match;
3045 int err, i;
3046
3047 for (i = 0; i < abx500_regulator.info_size; i++) {
3048 err = ab8500_regulator_register(
3049 pdev, match[i].init_data, i, match[i].of_node);
3050 if (err)
3051 return err;
3052 }
3053
3054 return 0;
3055}
3056
3057static int ab8500_regulator_probe(struct platform_device *pdev) 3040static int ab8500_regulator_probe(struct platform_device *pdev)
3058{ 3041{
3059 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 3042 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
3060 struct device_node *np = pdev->dev.of_node; 3043 struct device_node *np = pdev->dev.of_node;
3061 int err; 3044 struct of_regulator_match *match;
3045 int err, i;
3062 3046
3063 if (!ab8500) { 3047 if (!ab8500) {
3064 dev_err(&pdev->dev, "null mfd parent\n"); 3048 dev_err(&pdev->dev, "null mfd parent\n");
@@ -3075,24 +3059,20 @@ static int ab8500_regulator_probe(struct platform_device *pdev)
3075 "Error parsing regulator init data: %d\n", err); 3059 "Error parsing regulator init data: %d\n", err);
3076 return err; 3060 return err;
3077 } 3061 }
3078 return ab8500_regulator_of_probe(pdev, np);
3079}
3080
3081static int ab8500_regulator_remove(struct platform_device *pdev)
3082{
3083 int err;
3084 3062
3085 /* remove regulator debug */ 3063 match = abx500_regulator.match;
3086 err = ab8500_regulator_debug_exit(pdev); 3064 for (i = 0; i < abx500_regulator.info_size; i++) {
3087 if (err) 3065 err = ab8500_regulator_register(pdev, match[i].init_data, i,
3088 return err; 3066 match[i].of_node);
3067 if (err)
3068 return err;
3069 }
3089 3070
3090 return 0; 3071 return 0;
3091} 3072}
3092 3073
3093static struct platform_driver ab8500_regulator_driver = { 3074static struct platform_driver ab8500_regulator_driver = {
3094 .probe = ab8500_regulator_probe, 3075 .probe = ab8500_regulator_probe,
3095 .remove = ab8500_regulator_remove,
3096 .driver = { 3076 .driver = {
3097 .name = "ab8500-regulator", 3077 .name = "ab8500-regulator",
3098 .owner = THIS_MODULE, 3078 .owner = THIS_MODULE,