[PATCH] usb: gadget: udc: Fix duplicate uclass name

Mattijs Korpershoek mkorpershoek at baylibre.com
Wed Aug 7 09:07:20 CEST 2024


Hi Zixun,

Thank you for the patch.

On ven., août 02, 2024 at 11:28, Zixun LI <admin at hifiphile.com> wrote:

> Currently both USB host uclass and USB gadget uclass are using the same
> name "usb" which break uclass functions like uclass_get_by_name().
>
> Rename the uclass to "usb_gadget" to fix, also makes bind/unbind by class
> index (or sequence) working.
>
> This breaks the capacity of using "usb" as DT alias sequence numbering
> which needs a fix afterwards.

Have you identified boards which use the DT alias that will break
with this patch?

Maybe we can detail the required fix in the commit message a bit as well?
Or, if you know of a board that uses "usb" as DT alias sequence number,
we can submit a fix alongside with this one to document the fix.

>
> Signed-off-by: Zixun LI <admin at hifiphile.com>
> ---
>  drivers/usb/gadget/udc/udc-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/udc-uclass.c b/drivers/usb/gadget/udc/udc-uclass.c
> index fbe62bbce4..723d1cdfd7 100644
> --- a/drivers/usb/gadget/udc/udc-uclass.c
> +++ b/drivers/usb/gadget/udc/udc-uclass.c
> @@ -83,7 +83,7 @@ __weak int dm_usb_gadget_handle_interrupts(struct udevice *dev)
>  #if CONFIG_IS_ENABLED(DM)
>  UCLASS_DRIVER(usb_gadget_generic) = {
>  	.id		= UCLASS_USB_GADGET_GENERIC,
> -	.name		= "usb",
> +	.name		= "usb_gadget",
>  	.flags		= DM_UC_FLAG_SEQ_ALIAS,
>  };
>  #endif
> --
> 2.45.2


More information about the U-Boot mailing list