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.
Usb gadget driver could simple ignore the register operation, if
it find the driver has been registered already.
Signed-off-by: Lei Wen <leiwen@marvell.com>
/* unregister_netdev (dev->net);*/
/* free_netdev(dev->net);*/
+ dev->gadget = NULL;
set_gadget_data(gadget, NULL);
}
error("received NULL ptr");
goto fail;
}
+ if (usb_gadget_register_driver(ð_driver) < 0)
+ goto fail;
dev->network_started = 0;
return;
}
+ /* If the gadget not registered, simple return */
+ if (!dev->gadget)
+ return;
+
usb_gadget_disconnect(dev->gadget);
+ usb_gadget_unregister_driver(ð_driver);
}
static struct usb_gadget_driver eth_driver = {
if (status)
goto fail;
- status = usb_gadget_register_driver(ð_driver);
- if (status < 0)
- goto fail;
-
eth_register(netdev);
return 0;