power: regulator: Fix regulator_enable/disable() macros
PATCH v2 1/1 power: regulator: Fix regulator_enable/disable() macros
The commit 076265b75e61 ("compat: regulator: add enable/disable macros") added regulator_enable/disable() macros to provide a closer analogue to the Linux API.
These new macros wrap regulator_set_enable() that may return detailed error codes and should typically not directly be called by drivers.
Change the macros to wrap regulator_set_enable_if_allowed() that masks error codes consumers typically do not expect to closer match the behavior of the Linux API.
Also move the macros outside the #if #else blocks to make the macros available when !CONFIG_IS_ENABLED(DM_REGULATOR).
Fixes 076265b75e61 ("compat: regulator: add enable/disable macros")
Signed-off-by Jonas Karlman <[email protected]>
---
Changes in v2:
- Move macros outside the #if #else blocks
--- include/power/regulator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/power/regulator.h +3 -3
@@ -371,9 +371,6 @@ int regulator_get_enable(struct udevice *dev);*/ int regulator_set_enable (struct udevice *dev,bool enable); -#define regulator_enable (dev) regulator_set_enable(dev, true) -#define regulator_disable (dev) regulator_set_enable(dev, false) -/** * regulator_set_enable_if_allowed: set regulator enable state if allowed by * regulator
@@ -651,4 +648,7 @@ static inline int device_get_supply_regulator(struct udevice *dev, const char *s }#endif +#define regulator_enable (dev) regulator_set_enable_if_allowed(dev, true) +#define regulator_disable (dev) regulator_set_enable_if_allowed(dev, false) +#endif /* _INCLUDE_REGULATOR_H_ */
Signature · 1 line
2.54.0