From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitaly Kuzmichev Date: Fri, 26 Nov 2010 21:23:06 +0300 Subject: [U-Boot] [PATCH] usb_ether: register usb ethernet gadget at each eth init In-Reply-To: <1290741661-28108-1-git-send-email-leiwen@marvell.com> References: <1290741661-28108-1-git-send-email-leiwen@marvell.com> Message-ID: <4CEFFB0A.3080804@mvista.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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(ð_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.