Commit aa790740 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Greg Kroah-Hartman

USB: gadget: Add DEVTYPE support for Ethernet functions

The problem with Ethernet based networking devices is to clearly
identify what's their usage. Special interfaces like bridges, WiFi,
Bluetooth, WiMAX or WWAN are already using DEVTYPE identification.

This patch marks the Ethernet functions of gadgets from the device
type "gadget". Automatic setup of these interfaces can now happen
from userspace without the need of hardcoding the network interface
name.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a8d4211f
...@@ -746,6 +746,10 @@ static const struct net_device_ops eth_netdev_ops = { ...@@ -746,6 +746,10 @@ static const struct net_device_ops eth_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
static struct device_type gadget_type = {
.name = "gadget",
};
/** /**
* gether_setup - initialize one ethernet-over-usb link * gether_setup - initialize one ethernet-over-usb link
* @g: gadget to associated with these links * @g: gadget to associated with these links
...@@ -808,6 +812,7 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) ...@@ -808,6 +812,7 @@ int __init gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN])
dev->gadget = g; dev->gadget = g;
SET_NETDEV_DEV(net, &g->dev); SET_NETDEV_DEV(net, &g->dev);
SET_NETDEV_DEVTYPE(net, &gadget_type);
status = register_netdev(net); status = register_netdev(net);
if (status < 0) { if (status < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment