|
@@ -744,10 +744,11 @@ static struct device_type gadget_type = {
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
- * gether_setup - initialize one ethernet-over-usb link
|
|
|
+ * gether_setup_name - initialize one ethernet-over-usb link
|
|
|
* @g: gadget to associated with these links
|
|
|
* @ethaddr: NULL, or a buffer in which the ethernet address of the
|
|
|
* host side of the link is recorded
|
|
|
+ * @netname: name for network device (for example, "usb")
|
|
|
* Context: may sleep
|
|
|
*
|
|
|
* This sets up the single network link that may be exported by a
|
|
@@ -756,7 +757,8 @@ static struct device_type gadget_type = {
|
|
|
*
|
|
|
* Returns negative errno, or zero on success
|
|
|
*/
|
|
|
-int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
|
|
|
+int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
|
|
|
+ const char *netname)
|
|
|
{
|
|
|
struct eth_dev *dev;
|
|
|
struct net_device *net;
|
|
@@ -780,7 +782,7 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
|
|
|
|
|
|
/* network device setup */
|
|
|
dev->net = net;
|
|
|
- strcpy(net->name, "usb%d");
|
|
|
+ snprintf(net->name, sizeof(net->name), "%s%%d", netname);
|
|
|
|
|
|
if (get_ether_addr(dev_addr, net->dev_addr))
|
|
|
dev_warn(&g->dev,
|