[U-Boot] [PATCH v2 2/3] power: regulator: Introduce regulator_set_enable_if_allowed api
Simon Glass
sjg at chromium.org
Wed Jan 16 21:35:05 UTC 2019
On Fri, 11 Jan 2019 at 02:46, Lokesh Vutla <lokeshvutla at ti.com> wrote:
>
> regulator_set_enable() api throws an error in the following three cases:
> - when requested to disable an always-on regulator
> - when set_enable() ops not provided by regulator driver
> - when enabling is actually failed.(Error returned by the regulator driver)
>
> Sometimes consumer drivers doesn't want to track the first two scenarios
> and just need to worry about the case where enabling is actually failed.
> But it is also a good practice to have an error value returned in the
> first two cases.
>
> So introduce an api regulator_set_enable_if_allowed() which ignores the
> first two error cases and returns an error as given by regulator driver.
> Consumer drivers can use this api need not worry about the first two
> error conditions.
>
> Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
> ---
> drivers/power/regulator/regulator-uclass.c | 11 +++++++++++
> include/power/regulator.h | 11 +++++++++++
> test/dm/regulator.c | 21 +++++++++++++++++++++
> 3 files changed, 43 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list