1 From 00c4bd07a64061ec9ab9c35f5bf01ec6187138f4 Mon Sep 17 00:00:00 2001
2 From: Jonathan McDowell <noodles-4QvXXjU8Dv4@public.gmane.org>
3 Date: Thu, 26 Mar 2009 00:45:27 -0700
4 Subject: [PATCH] usb gadget: fix ethernet link reports to ethtool
6 The g_ether USB gadget driver currently decides whether or not there's a
7 link to report back for eth_get_link based on if the USB link speed is
8 set. The USB gadget speed is however often set even before the device is
9 enumerated. It seems more sensible to only report a "link" if we're
10 actually connected to a host that wants to talk to us. The patch below
11 does this for me - tested with the PXA27x UDC driver.
13 Signed-Off-By: Jonathan McDowell <noodles-4QvXXjU8Dv4@public.gmane.org>
14 Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
16 drivers/usb/gadget/u_ether.c | 8 +-------
17 1 files changed, 1 insertions(+), 7 deletions(-)
19 diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
20 index 96d65ca..4007770 100644
21 --- a/drivers/usb/gadget/u_ether.c
22 +++ b/drivers/usb/gadget/u_ether.c
23 @@ -175,12 +175,6 @@ static void eth_get_drvinfo(struct net_device *net, struct ethtool_drvinfo *p)
24 strlcpy(p->bus_info, dev_name(&dev->gadget->dev), sizeof p->bus_info);
27 -static u32 eth_get_link(struct net_device *net)
29 - struct eth_dev *dev = netdev_priv(net);
30 - return dev->gadget->speed != USB_SPEED_UNKNOWN;
33 /* REVISIT can also support:
34 * - WOL (by tracking suspends and issuing remote wakeup)
35 * - msglevel (implies updated messaging)
36 @@ -189,7 +183,7 @@ static u32 eth_get_link(struct net_device *net)
38 static struct ethtool_ops ops = {
39 .get_drvinfo = eth_get_drvinfo,
40 - .get_link = eth_get_link
41 + .get_link = ethtool_op_get_link,
44 static void defer_kevent(struct eth_dev *dev, int flag)