diff options
Diffstat (limited to 'drivers/usb/gadget/u_ether.c')
-rw-r--r-- | drivers/usb/gadget/u_ether.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 29c854bbca44..47cf48b51c9d 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -744,10 +744,11 @@ static struct device_type gadget_type = { | |||
744 | }; | 744 | }; |
745 | 745 | ||
746 | /** | 746 | /** |
747 | * gether_setup - initialize one ethernet-over-usb link | 747 | * gether_setup_name - initialize one ethernet-over-usb link |
748 | * @g: gadget to associated with these links | 748 | * @g: gadget to associated with these links |
749 | * @ethaddr: NULL, or a buffer in which the ethernet address of the | 749 | * @ethaddr: NULL, or a buffer in which the ethernet address of the |
750 | * host side of the link is recorded | 750 | * host side of the link is recorded |
751 | * @netname: name for network device (for example, "usb") | ||
751 | * Context: may sleep | 752 | * Context: may sleep |
752 | * | 753 | * |
753 | * This sets up the single network link that may be exported by a | 754 | * This sets up the single network link that may be exported by a |
@@ -756,7 +757,8 @@ static struct device_type gadget_type = { | |||
756 | * | 757 | * |
757 | * Returns negative errno, or zero on success | 758 | * Returns negative errno, or zero on success |
758 | */ | 759 | */ |
759 | int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | 760 | int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN], |
761 | const char *netname) | ||
760 | { | 762 | { |
761 | struct eth_dev *dev; | 763 | struct eth_dev *dev; |
762 | struct net_device *net; | 764 | struct net_device *net; |
@@ -780,7 +782,7 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
780 | 782 | ||
781 | /* network device setup */ | 783 | /* network device setup */ |
782 | dev->net = net; | 784 | dev->net = net; |
783 | strcpy(net->name, "usb%d"); | 785 | snprintf(net->name, sizeof(net->name), "%s%%d", netname); |
784 | 786 | ||
785 | if (get_ether_addr(dev_addr, net->dev_addr)) | 787 | if (get_ether_addr(dev_addr, net->dev_addr)) |
786 | dev_warn(&g->dev, | 788 | dev_warn(&g->dev, |