mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-23 08:01:59 +00:00
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>
This commit is contained in:
parent
29fca9f23a
commit
8202bc2945
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue