summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorEugen Hristev <eugen.hristev@collabora.com>2023-04-19 16:45:26 +0300
committerJaehoon Chung <jh80.chung@samsung.com>2023-07-04 11:21:12 +0900
commit8202bc29454cfdd5839058e4b79c36a3fbb221cf (patch)
tree744bd9cc4265fb5ad94e82a9e7ff25df44950c4e /drivers/power
parent29fca9f23a3b730cbf91c18617e25d9d8e3a26b7 (diff)
downloadu-boot-8202bc29454cfdd5839058e4b79c36a3fbb221cf.tar.gz
u-boot-8202bc29454cfdd5839058e4b79c36a3fbb221cf.tar.bz2
u-boot-8202bc29454cfdd5839058e4b79c36a3fbb221cf.zip
regulator: handle different error codes in regulator_set_enable_if_allowed
The regulator core can return different codes which are not considered a real error for this function. Return success in such cases. Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/regulator/regulator-uclass.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index d608f7c236..3a6ba69f6d 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -197,6 +197,12 @@ int regulator_set_enable_if_allowed(struct udevice *dev, bool enable)
ret = regulator_set_enable(dev, enable);
if (ret == -ENOSYS || ret == -EACCES)
return 0;
+ /* if we want to disable but it's in use by someone else */
+ if (!enable && ret == -EBUSY)
+ return 0;
+ /* if it's already enabled/disabled */
+ if (ret == -EALREADY)
+ return 0;
return ret;
}