Commit 237e75bf authored by Jonathan McDowell's avatar Jonathan McDowell Committed by Greg Kroah-Hartman

usb gadget: fix ethernet link reports to ethtool

The g_ether USB gadget driver currently decides whether or not there's a
link to report back for eth_get_link based on if the USB link speed is
set. The USB gadget speed is however often set even before the device is
enumerated. It seems more sensible to only report a "link" if we're
actually connected to a host that wants to talk to us. The patch below
does this for me - tested with the PXA27x UDC driver.
Signed-off-by: default avatarJonathan McDowell <noodles@earth.li>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9f76208c
...@@ -175,12 +175,6 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p) ...@@ -175,12 +175,6 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info); strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
} }
static u32 eth_get_link(struct net_device *net)
{
struct eth_dev *dev = netdev_priv(net);
return dev->gadget->speed != USB_SPEED_UNKNOWN;
}
/* REVISIT can also support: /* REVISIT can also support:
* - WOL (by tracking suspends and issuing remote wakeup) * - WOL (by tracking suspends and issuing remote wakeup)
* - msglevel (implies updated messaging) * - msglevel (implies updated messaging)
...@@ -189,7 +183,7 @@ static u32 eth_get_link(struct net_device *net) ...@@ -189,7 +183,7 @@ static u32 eth_get_link(struct net_device *net)
static struct ethtool_ops ops = { static struct ethtool_ops ops = {
.get_drvinfo = eth_get_drvinfo, .get_drvinfo = eth_get_drvinfo,
.get_link = eth_get_link .get_link = ethtool_op_get_link,
}; };
static void defer_kevent(struct eth_dev *dev, int flag) static void defer_kevent(struct eth_dev *dev, int flag)
......
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