Signed-off-by: Bjørn Mork <bjorn@xxxxxxx> --- What do you think about something like this? Does it have to be more complicated? Somewhat tested, and seems to do the job for me. drivers/net/usb/usbnet.c | 32 ++++++++++++++++++++++++++++++++ include/linux/usb/usbnet.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index fc9f578..2f60b2c 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1592,6 +1592,38 @@ int usbnet_resume (struct usb_interface *intf) } EXPORT_SYMBOL_GPL(usbnet_resume); +int usbnet_pre_reset (struct usb_interface *intf) +{ + struct usbnet *dev = usb_get_intfdata(intf); + + if (!dev->suspend_count++) { + netif_device_detach (dev->net); + usbnet_terminate_urbs(dev); + usb_kill_urb(dev->interrupt); + } + return 0; +} +EXPORT_SYMBOL_GPL(usbnet_pre_reset); + +int usbnet_post_reset (struct usb_interface *intf) +{ + struct usbnet *dev = usb_get_intfdata(intf); + + if (!--dev->suspend_count) { + /* resume interrupt URBs */ + if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags)) + usb_submit_urb(dev->interrupt, GFP_NOIO); + + netif_device_attach (dev->net); + if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { + if (!(dev->txq.qlen >= TX_QLEN(dev))) + netif_tx_wake_all_queues(dev->net); + tasklet_schedule (&dev->bh); + } + } + return 0; +} +EXPORT_SYMBOL_GPL(usbnet_post_reset); /*-------------------------------------------------------------------------*/ diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index f87cf62..2ae12b9 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -159,6 +159,8 @@ struct driver_info { extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); extern int usbnet_suspend(struct usb_interface *, pm_message_t); extern int usbnet_resume(struct usb_interface *); +extern int usbnet_pre_reset(struct usb_interface *); +extern int usbnet_post_reset(struct usb_interface *); extern void usbnet_disconnect(struct usb_interface *); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html