diff options
| author | Jonas Karlman <[email protected]> | 2026-07-10 13:15:53 +0000 |
|---|---|---|
| committer | Peng Fan <[email protected]> | 2026-07-12 16:18:32 +0800 |
| commit | 0f04bbf9ab3751405308f0a8aef2b6016a072b7d (patch) | |
| tree | fb9bc6d5c23f545b5ae8fb4e352cdcdf4e700b00 | |
| parent | 35c3e733fe4cbaa91f6cc02ddbb30f6feb3eb1fc (diff) | |
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]>
Signed-off-by: Peng Fan <[email protected]>
| -rw-r--r-- | include/power/regulator.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/power/regulator.h b/include/power/regulator.h index b8023721a16..8d4d1450b90 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -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_ */ |
