Commit c155e0ab authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'regulator/topic/core' into regulator-next

parents 905373b6 32165230
...@@ -3913,6 +3913,16 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3913,6 +3913,16 @@ regulator_register(const struct regulator_desc *regulator_desc,
goto clean; goto clean;
} }
if ((config->ena_gpio || config->ena_gpio_initialized) &&
gpio_is_valid(config->ena_gpio)) {
ret = regulator_ena_gpio_request(rdev, config);
if (ret != 0) {
rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
config->ena_gpio, ret);
goto clean;
}
}
/* register with sysfs */ /* register with sysfs */
rdev->dev.class = &regulator_class; rdev->dev.class = &regulator_class;
rdev->dev.parent = dev; rdev->dev.parent = dev;
...@@ -3921,21 +3931,11 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3921,21 +3931,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
ret = device_register(&rdev->dev); ret = device_register(&rdev->dev);
if (ret != 0) { if (ret != 0) {
put_device(&rdev->dev); put_device(&rdev->dev);
goto clean; goto wash;
} }
dev_set_drvdata(&rdev->dev, rdev); dev_set_drvdata(&rdev->dev, rdev);
if ((config->ena_gpio || config->ena_gpio_initialized) &&
gpio_is_valid(config->ena_gpio)) {
ret = regulator_ena_gpio_request(rdev, config);
if (ret != 0) {
rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
config->ena_gpio, ret);
goto wash;
}
}
/* set regulator constraints */ /* set regulator constraints */
if (init_data) if (init_data)
constraints = &init_data->constraints; constraints = &init_data->constraints;
...@@ -3974,13 +3974,13 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3974,13 +3974,13 @@ regulator_register(const struct regulator_desc *regulator_desc,
scrub: scrub:
regulator_ena_gpio_free(rdev); regulator_ena_gpio_free(rdev);
wash:
device_unregister(&rdev->dev); device_unregister(&rdev->dev);
/* device core frees rdev */ /* device core frees rdev */
rdev = ERR_PTR(ret); rdev = ERR_PTR(ret);
goto out; goto out;
wash:
regulator_ena_gpio_free(rdev);
clean: clean:
kfree(rdev); kfree(rdev);
rdev = ERR_PTR(ret); rdev = ERR_PTR(ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment