From: David Brownell Date: Sun, 7 Sep 2008 04:33:49 +0000 (-0700) Subject: usb gadget: cdc ethernet notification bugfix X-Git-Tag: v2.6.28-rc1~254^2~46 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=29bac7b7661bbbdbbd32bc1e6cedca22f260da7f;p=linux-2.6-omap-h63xx.git usb gadget: cdc ethernet notification bugfix Bugfix for the new CDC Ethernet code: as part of activating the network interface's USB link, make sure its link management code knows whether the interface is open or not. Without this fix, the link won't work right when it's brought up before the link is active ... because the initial notification it sends will have the wrong link state (down, not up). Makes it hard to bridge these links (on the host side), among other things. Signed-off-by: David Brownell Cc: stable [2.6.27] Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index dbd575a194f..66948b72bb9 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c @@ -873,6 +873,13 @@ struct net_device *gether_connect(struct gether *link) spin_lock(&dev->lock); dev->port_usb = link; link->ioport = dev; + if (netif_running(dev->net)) { + if (link->open) + link->open(link); + } else { + if (link->close) + link->close(link); + } spin_unlock(&dev->lock); netif_carrier_on(dev->net);