summaryrefslogtreecommitdiff
path: root/drivers/hwmon/adcxx.c
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-04-26 13:29:45 +0300
committerMark Brown <broonie@kernel.org>2016-04-27 18:32:19 +0300
commit45389c47526d1eca70f96872c172aea0941e8520 (patch)
tree6a81f0253984258847c4ef072720752b94d81b3b /drivers/hwmon/adcxx.c
parentcbc13a66fdd89ac5e360af32fec0a1a4fcd4d2f1 (diff)
downloadlinux-45389c47526d1eca70f96872c172aea0941e8520.tar.xz
regulator: core: Add early supply resolution for regulators
The call to set_machine_constraints() in regulator_register(), will attempt to get the voltage for the regulator. If a regulator is in bypass will fail to get the voltage (ie. it's bypass voltage) and hence register the regulator, because the supply for the regulator has not been resolved yet. To fix this, add a call to regulator_resolve_supply() before we call set_machine_constraints(). If the call to regulator_resolve_supply() fails, rather than returning an error at this point, allow the registration of the regulator to continue because for some regulators resolving the supply at this point may not be necessary and it will be resolved later as more regulators are added. Furthermore, if the supply is still not resolved for a bypassed regulator, this will be detected when we attempt to get the voltage for the regulator and an error will be propagated at this point. If a bypassed regulator does not have a supply when we attempt to get the voltage, rather than returing -EINVAL, return -EPROBE_DEFER instead to allow the registration of the regulator to be deferred and tried again later. Please note that regulator_resolve_supply() will call regulator_dev_lookup() which may acquire the regulator_list_mutex. To avoid any deadlocks we cannot hold the regulator_list_mutex when calling regulator_resolve_supply(). Therefore, rather than holding the lock around a large portion of the registration code, just hold the lock when aquiring any GPIOs and setting up supplies because these sections may add entries to the regulator_map_list and regulator_ena_gpio_list, respectively. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/hwmon/adcxx.c')
0 files changed, 0 insertions, 0 deletions