[U-Boot] [PATCH] usb_ether: register usb ethernet gadget at each eth init

Vitaly Kuzmichev vkuzmichev at mvista.com
Fri Nov 26 19:23:06 CET 2010


Hi Lei,

Lei Wen wrote:
> Since the ether may not be the only one usb gadget would be used
> in the uboot, it is neccessary to do the register each time the
> eth begin to work to make usb gadget driver less confussed when
> we want to use two different usb gadget at the same time.
> [...]
> @@ -1788,6 +1788,8 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd)
>  		error("received NULL ptr");
>  		goto fail;
>  	}
> +	if (usb_gadget_register_driver(&eth_driver) < 0)
> +		goto fail;

You probably need then at least to remove usb_gadget_register_driver
call from usb_eth_initialize. And add usb_gadget_unregister_driver in
usb_eth_halt.
For example, my UDC driver returns EBUSY if another gadget driver tries
to register itself. (Yes, I do not want to have more than 1 gadget).
With your patch the gadget driver will fail each time when initializing.
Anyway if I "fix" my UDC driver some day the Ether gadget will try to
register itself twice (and more times later). So I will have to protect
it against this bad behavior.


More information about the U-Boot mailing list