Skip to content

Commit ff33132

Browse files
M-Vaittinenbroonie
authored andcommitted
regulator: change devm_regulator_get_enable_optional() stub to return Ok
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 <[email protected]> Fixes: da279e6 ("regulator: Add devm helpers for get and enable") Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/ZiedtOE00Zozd3XO@fedora Signed-off-by: Mark Brown <[email protected]>
1 parent 96e20ad commit ff33132

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/regulator/consumer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ static inline int devm_regulator_get_enable(struct device *dev, const char *id)
326326
static inline int devm_regulator_get_enable_optional(struct device *dev,
327327
const char *id)
328328
{
329-
return -ENODEV;
329+
return 0;
330330
}
331331

332332
static inline struct regulator *__must_check

0 commit comments

Comments
 (0)