summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMatti Vaittinen <mazziesaccount@gmail.com>2024-04-23 14:38:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-17 13:14:25 +0300
commit9fdbb581c737016260917a2b459f94f70eb51e69 (patch)
treebeb63ce4807b2165e74c7ea299720597a4bd1724 /include/linux
parent13aeaa60b0602bcee10d6579b35cf0e34e90d60c (diff)
downloadlinux-9fdbb581c737016260917a2b459f94f70eb51e69.tar.xz
regulator: change devm_regulator_get_enable_optional() stub to return Ok
[ Upstream commit ff33132605c1a0acea59e4c523cb7c6fabe856b2 ] The devm_regulator_get_enable_optional() should be a 'call and forget' API, meaning, when it is used to enable the regulators, the API does not provide a handle to do any further control of the regulators. It gives no real benefit to return an error from the stub if CONFIG_REGULATOR is not set. On the contrary, returning an error is causing problems to drivers when hardware is such it works out just fine with no regulator control. Returning an error forces drivers to specifically handle the case where CONFIG_REGULATOR is not set, making the mere existence of the stub questionalble. Change the stub implementation for the devm_regulator_get_enable_optional() to return Ok so drivers do not separately handle the case where the CONFIG_REGULATOR is not set. Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> Fixes: da279e6965b3 ("regulator: Add devm helpers for get and enable") Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/ZiedtOE00Zozd3XO@fedora Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/regulator/consumer.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 71232fb7dda3..ed180ca419da 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -326,7 +326,7 @@ static inline int devm_regulator_get_enable(struct device *dev, const char *id)
static inline int devm_regulator_get_enable_optional(struct device *dev,
const char *id)
{
- return -ENODEV;
+ return 0;
}
static inline struct regulator *__must_check