regulator: change devm_regulator_get_enable_optional() stub to return Ok
PATCH 1/1 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.
--- include/linux/regulator/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/regulator/consumer.h +1 -1
@@ -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
base-commit: f7638784bd0cf2ca9daebd47477983811f832300
Signature · 14 lines
2.43.2 -- Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =]
Quoted 12 lines · Matti Vaittinen
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 ifCONFIG_REGULATORis 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_REGULATORis not set, making the mere existence of the stub questionalble.
Quoted 6 lines
Change the stub implementation for the
devm_regulator_get_enable_optional()to return Ok so drivers do not separately handle the case where theCONFIG_REGULATORis not set.Signed-off-by Matti Vaittinen <[email protected]>Fixes da279e6965b3 ("regulator: Add devm helpers for get and enable")
Quoted 34 lines
--- include/linux/regulator/consumer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/regulator/consumer.h +1
-1@@ -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_checkbase-commit:
f7638784bd0cf2ca9daebd47477983811f832300Signature · 14 lines
2.43.2 -- Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =]
Mark Brown
maintainerQuoted 6 lines · Matti Vaittinen
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 ifCONFIG_REGULATORis not set.
Quoted 7 lines
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_REGULATORis not set, making the mere existence of the stub questionalble.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: change devm_regulator_get_enable_optional() stub to return Ok
commit: ff33132605c1a0acea59e4c523cb7c6fabe856b2
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark