summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_ether.h
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2012-05-10 10:08:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-10 12:26:17 -0700
commit036e98b2162d1ed361ed6d31ab009764bb507340 (patch)
treeaabe621c21bd26eb3b6d4d1db39b2ed4caea7c39 /drivers/usb/gadget/u_ether.h
parentc3c04b2945eccd8cdc07bbede3090c18dfed43c0 (diff)
downloadlinux-036e98b2162d1ed361ed6d31ab009764bb507340.tar.bz2
usb: gadget: Add variant of gether_setup to customize the device name
This is needed to avoid name collisions on SoCs that have both usb gadget and usb host, where usb0 may be the rndis interface or a usb ethernet adapter. Signed-off-by: Mike Lockwood <lockwood@android.com> Signed-off-by: Benoit Goby <benoit@android.com> [make gether_setup a static inline function] Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/u_ether.h')
-rw-r--r--drivers/usb/gadget/u_ether.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h
index 8012357e98aa..6f128cd0d599 100644
--- a/drivers/usb/gadget/u_ether.h
+++ b/drivers/usb/gadget/u_ether.h
@@ -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 */