]> git.dujemihanovic.xyz Git - u-boot.git/commit
power: regulator: Introduce regulator_set_enable_if_allowed api
authorLokesh Vutla <lokeshvutla@ti.com>
Fri, 11 Jan 2019 09:45:51 +0000 (15:15 +0530)
committerSimon Glass <sjg@chromium.org>
Sat, 9 Feb 2019 19:50:22 +0000 (12:50 -0700)
commitcc4a224af226b2ea818d32af26742aaad8a3983e
tree2cb0c9c521146746ee924e14f83a2f8a3e318be3
parentf93fab312615ce0bc9aac33f9dcd876a3fed1290
power: regulator: Introduce regulator_set_enable_if_allowed api

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@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/power/regulator/regulator-uclass.c
include/power/regulator.h
test/dm/regulator.c