diff mbox series

[v2] usb: dwc3-generic: fix support without DM_REGULATOR

Message ID 20240415115728.448176-1-robert.marko@sartura.hr
State New
Delegated to: Marek Vasut
Headers show
Series [v2] usb: dwc3-generic: fix support without DM_REGULATOR | expand

Commit Message

Robert Marko April 15, 2024, 11:56 a.m. UTC
Recent addition of vbus-supply support has broke platform which dont use
controllable regulators for USB.

Issue is that even withou DM_REGULATOR being enabled regulator related
functions will still build as there is a stub in regulator.h but they will
simply return -ENOSYS which will then make dwc3_generic_host_probe()
return the same error thus breaking probe.

So, check whether return code is -ENOSYS before erroring out.

Fixes: de451d5d5b6f ("usb: dwc3-generic: support external vbus regulator")
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
---
Changes in v2:
* Drop #ifdefs and check for -ENOSYS that regulator stub returns

 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Caleb Connolly April 15, 2024, 12:51 p.m. UTC | #1
On 15/04/2024 12:56, Robert Marko wrote:
> Recent addition of vbus-supply support has broke platform which dont use
> controllable regulators for USB.
> 
> Issue is that even withou DM_REGULATOR being enabled regulator related
> functions will still build as there is a stub in regulator.h but they will
> simply return -ENOSYS which will then make dwc3_generic_host_probe()
> return the same error thus breaking probe.
> 
> So, check whether return code is -ENOSYS before erroring out.
> 
> Fixes: de451d5d5b6f ("usb: dwc3-generic: support external vbus regulator")
> Signed-off-by: Robert Marko <robert.marko@sartura.hr>

Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
> Changes in v2:
> * Drop #ifdefs and check for -ENOSYS that regulator stub returns
> 
>  drivers/usb/dwc3/dwc3-generic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 7a00529a2a..df0b0b8c02 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -248,7 +248,7 @@ static int dwc3_generic_host_probe(struct udevice *dev)
>  
>  	/* Only returns an error if regulator is valid and failed to enable due to a driver issue */
>  	rc = regulator_set_enable_if_allowed(priv->vbus_supply, true);
> -	if (rc)
> +	if (rc && rc != -ENOSYS)
>  		return rc;
>  
>  	hccr = (struct xhci_hccr *)priv->gen_priv.base;
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 7a00529a2a..df0b0b8c02 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -248,7 +248,7 @@  static int dwc3_generic_host_probe(struct udevice *dev)
 
 	/* Only returns an error if regulator is valid and failed to enable due to a driver issue */
 	rc = regulator_set_enable_if_allowed(priv->vbus_supply, true);
-	if (rc)
+	if (rc && rc != -ENOSYS)
 		return rc;
 
 	hccr = (struct xhci_hccr *)priv->gen_priv.base;