提交 36433127 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

USB: address FIXME in usbnet w.r.t drivers claiming multiple interfaces

This fixes the issue of drivers claiming multiple interfaces. Operations
are stopped as soon as an interface is suspend and resumed only as
all interfaces have been resumed.
Signed-off-by: NOliver Neukum <oneukum@suse.de>
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 741ec4e6
...@@ -1252,20 +1252,23 @@ EXPORT_SYMBOL_GPL(usbnet_probe); ...@@ -1252,20 +1252,23 @@ EXPORT_SYMBOL_GPL(usbnet_probe);
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* FIXME these suspend/resume methods assume non-CDC style /*
* devices, with only one interface. * suspend the whole driver as soon as the first interface is suspended
* resume only when the last interface is resumed
*/ */
int usbnet_suspend (struct usb_interface *intf, pm_message_t message) int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
{ {
struct usbnet *dev = usb_get_intfdata(intf); struct usbnet *dev = usb_get_intfdata(intf);
/* accelerate emptying of the rx and queues, to avoid if (!dev->suspend_count++) {
* having everything error out. /* accelerate emptying of the rx and queues, to avoid
*/ * having everything error out.
netif_device_detach (dev->net); */
(void) unlink_urbs (dev, &dev->rxq); netif_device_detach (dev->net);
(void) unlink_urbs (dev, &dev->txq); (void) unlink_urbs (dev, &dev->rxq);
(void) unlink_urbs (dev, &dev->txq);
}
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(usbnet_suspend); EXPORT_SYMBOL_GPL(usbnet_suspend);
...@@ -1274,8 +1277,10 @@ int usbnet_resume (struct usb_interface *intf) ...@@ -1274,8 +1277,10 @@ int usbnet_resume (struct usb_interface *intf)
{ {
struct usbnet *dev = usb_get_intfdata(intf); struct usbnet *dev = usb_get_intfdata(intf);
netif_device_attach (dev->net); if (!--dev->suspend_count) {
tasklet_schedule (&dev->bh); netif_device_attach (dev->net);
tasklet_schedule (&dev->bh);
}
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(usbnet_resume); EXPORT_SYMBOL_GPL(usbnet_resume);
......
...@@ -32,6 +32,7 @@ struct usbnet { ...@@ -32,6 +32,7 @@ struct usbnet {
const char *driver_name; const char *driver_name;
wait_queue_head_t *wait; wait_queue_head_t *wait;
struct mutex phy_mutex; struct mutex phy_mutex;
unsigned char suspend_count;
/* i/o info: pipes etc */ /* i/o info: pipes etc */
unsigned in, out; unsigned in, out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册