mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
UPSTREAM: regulator: core: Request GPIO before creating sysfs entries
regulator_attr_is_visible (which is a .is_visible callback of
regulator_dev_group attribute_grpup) checks rdev->ena_pin to decide if
"status" file should be present in sysfs. This field is set at the end
of regulator_ena_gpio_request so it has to be called before
device_register() otherwise this test will always fail, causing "status"
file to not be visible.
Since regulator_attr_is_visible also tests for is_enabled() op, this
problem is only visible for regulators that does not define this
callback, like regulator-fixed.c.
Signed-off-by: Krzysztof Adamski <krzysztof.adamski@tieto.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit daad134d66)
Change-Id: I4c80adfd790bfec41b4817430c3af7c54a7b446e
Signed-off-by: David Wu <david.wu@rock-chips.com>
This commit is contained in:
committed by
Huang, Tao
parent
8b8b946452
commit
bd0d179b27
@@ -3911,6 +3911,16 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
||||
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 wash;
|
||||
}
|
||||
}
|
||||
|
||||
/* register with sysfs */
|
||||
rdev->dev.class = ®ulator_class;
|
||||
rdev->dev.parent = dev;
|
||||
@@ -3924,16 +3934,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
||||
|
||||
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 */
|
||||
if (init_data)
|
||||
constraints = &init_data->constraints;
|
||||
|
||||
Reference in New Issue
Block a user