diff options
| author | Kevin Cernekee <cernekee@gmail.com> | 2012-06-25 00:11:22 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-09 11:27:35 -0400 |
| commit | f58f16f2039cca9dc58a406593e5f46c6a35e0df (patch) | |
| tree | 5b62c1dbbeb247ab596ae739a924044b898ccf7e /drivers/usb | |
| parent | a0f7a5ac6e752612427077b2c04db1e0ae720a66 (diff) | |
usb: gadget: Fix g_ether interface link status
commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.
A "usb0" interface that has never been connected to a host has an unknown
operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
when queried by ifconfig, ifplugd, etc. This is a result of calling
netif_carrier_off() too early in the probe function; it should be called
after register_netdev().
Similar problems have been fixed in many other drivers, e.g.:
e826eafa6 (bonding: Call netif_carrier_off after register_netdevice)
0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe)
6a3c869a6 (cxgb4: fix reported state of interfaces without link)
Fix is to move netif_carrier_off() to the end of the function.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/gadget/u_ether.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 2ac1d214732..a52404a1aef 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
| @@ -803,12 +803,6 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
| 803 | 803 | ||
| 804 | SET_ETHTOOL_OPS(net, &ops); | 804 | SET_ETHTOOL_OPS(net, &ops); |
| 805 | 805 | ||
| 806 | /* two kinds of host-initiated state changes: | ||
| 807 | * - iff DATA transfer is active, carrier is "on" | ||
| 808 | * - tx queueing enabled if open *and* carrier is "on" | ||
| 809 | */ | ||
| 810 | netif_carrier_off(net); | ||
| 811 | |||
| 812 | dev->gadget = g; | 806 | dev->gadget = g; |
| 813 | SET_NETDEV_DEV(net, &g->dev); | 807 | SET_NETDEV_DEV(net, &g->dev); |
| 814 | SET_NETDEV_DEVTYPE(net, &gadget_type); | 808 | SET_NETDEV_DEVTYPE(net, &gadget_type); |
| @@ -822,6 +816,12 @@ int gether_setup(struct usb_gadget *g, u8 ethaddr[ETH_ALEN]) | |||
| 822 | INFO(dev, "HOST MAC %pM\n", dev->host_mac); | 816 | INFO(dev, "HOST MAC %pM\n", dev->host_mac); |
| 823 | 817 | ||
| 824 | the_dev = dev; | 818 | the_dev = dev; |
| 819 | |||
| 820 | /* two kinds of host-initiated state changes: | ||
| 821 | * - iff DATA transfer is active, carrier is "on" | ||
| 822 | * - tx queueing enabled if open *and* carrier is "on" | ||
| 823 | */ | ||
| 824 | netif_carrier_off(net); | ||
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | return status; | 827 | return status; |
