diff options
author | Mark Brown <broonie@kernel.org> | 2016-03-13 04:19:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-03-13 04:19:22 -0400 |
commit | c155e0ab13fa6b318a026a7f5d3ee15ed7aba571 (patch) | |
tree | dbc82fac633573b29f8f92f9264a5573d147febb | |
parent | 905373b6377394ae6819574ed3c170632c8bab59 (diff) | |
parent | 32165230eb6e629d7f88e66e0bd90a201549de53 (diff) |
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
-rw-r--r-- | drivers/regulator/core.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 4405be13eb0e..055f8c1a83a8 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3913,6 +3913,16 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3913 | goto clean; | 3913 | goto clean; |
3914 | } | 3914 | } |
3915 | 3915 | ||
3916 | if ((config->ena_gpio || config->ena_gpio_initialized) && | ||
3917 | gpio_is_valid(config->ena_gpio)) { | ||
3918 | ret = regulator_ena_gpio_request(rdev, config); | ||
3919 | if (ret != 0) { | ||
3920 | rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", | ||
3921 | config->ena_gpio, ret); | ||
3922 | goto clean; | ||
3923 | } | ||
3924 | } | ||
3925 | |||
3916 | /* register with sysfs */ | 3926 | /* register with sysfs */ |
3917 | rdev->dev.class = ®ulator_class; | 3927 | rdev->dev.class = ®ulator_class; |
3918 | rdev->dev.parent = dev; | 3928 | rdev->dev.parent = dev; |
@@ -3921,21 +3931,11 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3921 | ret = device_register(&rdev->dev); | 3931 | ret = device_register(&rdev->dev); |
3922 | if (ret != 0) { | 3932 | if (ret != 0) { |
3923 | put_device(&rdev->dev); | 3933 | put_device(&rdev->dev); |
3924 | goto clean; | 3934 | goto wash; |
3925 | } | 3935 | } |
3926 | 3936 | ||
3927 | dev_set_drvdata(&rdev->dev, rdev); | 3937 | dev_set_drvdata(&rdev->dev, rdev); |
3928 | 3938 | ||
3929 | if ((config->ena_gpio || config->ena_gpio_initialized) && | ||
3930 | gpio_is_valid(config->ena_gpio)) { | ||
3931 | ret = regulator_ena_gpio_request(rdev, config); | ||
3932 | if (ret != 0) { | ||
3933 | rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", | ||
3934 | config->ena_gpio, ret); | ||
3935 | goto wash; | ||
3936 | } | ||
3937 | } | ||
3938 | |||
3939 | /* set regulator constraints */ | 3939 | /* set regulator constraints */ |
3940 | if (init_data) | 3940 | if (init_data) |
3941 | constraints = &init_data->constraints; | 3941 | constraints = &init_data->constraints; |
@@ -3974,13 +3974,13 @@ unset_supplies: | |||
3974 | 3974 | ||
3975 | scrub: | 3975 | scrub: |
3976 | regulator_ena_gpio_free(rdev); | 3976 | regulator_ena_gpio_free(rdev); |
3977 | |||
3978 | wash: | ||
3979 | device_unregister(&rdev->dev); | 3977 | device_unregister(&rdev->dev); |
3980 | /* device core frees rdev */ | 3978 | /* device core frees rdev */ |
3981 | rdev = ERR_PTR(ret); | 3979 | rdev = ERR_PTR(ret); |
3982 | goto out; | 3980 | goto out; |
3983 | 3981 | ||
3982 | wash: | ||
3983 | regulator_ena_gpio_free(rdev); | ||
3984 | clean: | 3984 | clean: |
3985 | kfree(rdev); | 3985 | kfree(rdev); |
3986 | rdev = ERR_PTR(ret); | 3986 | rdev = ERR_PTR(ret); |