
Vitaly Kuzmichev wrote:
Hi Lei,
Lei Wen wrote:
Hi Vitaly, [...]
if (usb_gadget_register_driver(ð_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.
I am afraid that remove usb_gadget_register_driver call from usb_eth_initialize is not possible. For tftp as example, it would call eth_halt before the eth_init. If we do the remove behavior, the gadget still not valid yet in the first eth_halt call which would cause the uboot becomes halt.
The gadget driver handles this properly. Right now it just does usb_gadget_disconnect which has no effect when no gadget was requested from the UDC driver yet.
I was wrong... usb_gadget_disconnect does not care about NULL pointer passed. :/
Best regards, Vitaly.