diff options
author | Jonas Karlman <jonas@kwiboo.se> | 2023-07-19 21:20:57 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-14 09:14:41 -0400 |
commit | 0830333c474379e0249c07fb15c5fe80880fcd36 (patch) | |
tree | a62dbee74f282656668c34c679d196461efb8813 /drivers | |
parent | 335799b7252a1d9125bf9565119d771b8599b6b3 (diff) | |
download | u-boot-0830333c474379e0249c07fb15c5fe80880fcd36.tar.gz u-boot-0830333c474379e0249c07fb15c5fe80880fcd36.tar.bz2 u-boot-0830333c474379e0249c07fb15c5fe80880fcd36.zip |
usb: ehci-generic: Use regulator_set_enable_if_allowed
With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.
Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/host/ehci-generic.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index a765a307a3..936e30438d 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -39,14 +39,10 @@ static int ehci_enable_vbus_supply(struct udevice *dev) if (ret && ret != -ENOENT) return ret; - if (priv->vbus_supply) { - ret = regulator_set_enable(priv->vbus_supply, true); - if (ret) { - dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret); - return ret; - } - } else { - dev_dbg(dev, "No vbus supply\n"); + ret = regulator_set_enable_if_allowed(priv->vbus_supply, true); + if (ret && ret != -ENOSYS) { + dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret); + return ret; } return 0; @@ -54,10 +50,13 @@ static int ehci_enable_vbus_supply(struct udevice *dev) static int ehci_disable_vbus_supply(struct generic_ehci *priv) { - if (priv->vbus_supply) - return regulator_set_enable(priv->vbus_supply, false); - else - return 0; + int ret; + + ret = regulator_set_enable_if_allowed(priv->vbus_supply, false); + if (ret && ret != -ENOSYS) + return ret; + + return 0; } static int ehci_usb_probe(struct udevice *dev) |