UPSTREAM: regulator: core: Request GPIO before creating sysfs entries
authorKrzysztof Adamski <krzysztof.adamski@tieto.com>
Mon, 22 Feb 2016 08:24:00 +0000 (09:24 +0100)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commitbd0d179b279e69d9c1dd36a8bbc2f032bf16ed72
tree276178967d4f96f48c5c773ec77b0e4ef788a747
parent8b8b946452098631775c333a3c32de3be25fc68a
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 daad134d66492a9f641163c94510549770b39657)

Change-Id: I4c80adfd790bfec41b4817430c3af7c54a7b446e
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/regulator/core.c