[U-Boot] [PATCH 2/3] power: regulator: Introduce regulator_set_enable_if_allowed api

Simon Glass sjg at chromium.org
Thu Jan 10 12:56:48 UTC 2019


On Sun, 6 Jan 2019 at 23:13, 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 +++++++++++
>  2 files changed, 22 insertions(+)

Thanks for the patch. But please do adjust the tests to call this
function and check that it does the right thing.


More information about the U-Boot mailing list