Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303888
b: refs/heads/master
c: 036e98b
h: refs/heads/master
v: v3
  • Loading branch information
Mike Lockwood authored and Greg Kroah-Hartman committed May 10, 2012
1 parent c675aee commit 6a98f1e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c3c04b2945eccd8cdc07bbede3090c18dfed43c0
refs/heads/master: 036e98b2162d1ed361ed6d31ab009764bb507340
8 changes: 5 additions & 3 deletions trunk/drivers/usb/gadget/u_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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,
Expand Down
21 changes: 20 additions & 1 deletion trunk/drivers/usb/gadget/u_ether.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,28 @@ struct gether {
|USB_CDC_PACKET_TYPE_PROMISCUOUS \
|USB_CDC_PACKET_TYPE_DIRECTED)

/* variant of gether_setup that allows customizing network device name */
int gether_setup_name(struct usb_gadget *g, u8 ethaddr[ETH_ALEN],
const char *netname);

/* netdev setup/teardown as directed by the gadget driver */
int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]);
/* gether_setup - 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
* Context: may sleep
*
* This sets up the single network link that may be exported by a
* gadget driver using this framework. The link layer addresses are
* set up using module parameters.
*
* Returns negative errno, or zero on success
*/
static inline int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
{
return gether_setup_name(g, ethaddr, "usb");
}

void gether_cleanup(void);

/* connect/disconnect is handled by individual functions */
Expand Down

0 comments on commit 6a98f1e

Please sign in to comment.