diff options
author | David Brownell <david-b@pacbell.net> | 2005-04-18 17:39:22 -0700 |
---|---|---|
committer | Greg K-H <gregkh@suse.de> | 2005-04-18 17:39:22 -0700 |
commit | 27d72e8572336d9f4e17a12ac924cb5223a5758d (patch) | |
tree | 791a046b5d860233f652973d0627752b67a3c600 /drivers/usb/net | |
parent | c6053ecffb895f6c0e0ec9c1d298e35cffc1f7a6 (diff) | |
download | linux-27d72e8572336d9f4e17a12ac924cb5223a5758d.tar.gz linux-27d72e8572336d9f4e17a12ac924cb5223a5758d.tar.bz2 linux-27d72e8572336d9f4e17a12ac924cb5223a5758d.zip |
[PATCH] usb suspend updates (interface suspend)
This is the first of a few installments of PM API updates to match the
recent switch to "pm_message_t". This installment primarily affects
USB device drivers (for USB interfaces), and it changes the handful of
drivers which currently implement suspend methods:
- <linux/usb.h> and usbcore, signature change
- Some drivers only changed the signature, net effect this just
shuts up "sparse -Wbitwise":
* hid-core
* stir4200
- Two network drivers did that, and also grew slightly more
featureful suspend code ... they now properly shut down
their activities. (As should stir4200...)
* pegasus
* usbnet
Note that the Wake-On-Lan (WOL) support in pegasus doesn't yet work; looks
to me like it's missing a request to turn it on, vs just configuring it.
The ASIX code in usbnet also has WOL hooks that are ready to use; untested.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Index: gregkh-2.6/drivers/net/irda/stir4200.c
===================================================================
Diffstat (limited to 'drivers/usb/net')
-rw-r--r-- | drivers/usb/net/pegasus.c | 22 | ||||
-rw-r--r-- | drivers/usb/net/usbnet.c | 10 |
2 files changed, 30 insertions, 2 deletions
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index f6c19d73b7da..a02be795d63e 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c @@ -1364,11 +1364,18 @@ static void pegasus_disconnect(struct usb_interface *intf) free_netdev(pegasus->net); } -static int pegasus_suspend (struct usb_interface *intf, pm_message_t state) +static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) { struct pegasus *pegasus = usb_get_intfdata(intf); netif_device_detach (pegasus->net); + if (netif_running(pegasus->net)) { + cancel_delayed_work(&pegasus->carrier_check); + + usb_kill_urb(pegasus->rx_urb); + usb_kill_urb(pegasus->intr_urb); + } + intf->dev.power.power_state = PMSG_SUSPEND; return 0; } @@ -1376,7 +1383,20 @@ static int pegasus_resume (struct usb_interface *intf) { struct pegasus *pegasus = usb_get_intfdata(intf); + intf->dev.power.power_state = PMSG_ON; netif_device_attach (pegasus->net); + if (netif_running(pegasus->net)) { + pegasus->rx_urb->status = 0; + pegasus->rx_urb->actual_length = 0; + read_bulk_callback(pegasus->rx_urb, 0); + + pegasus->intr_urb->status = 0; + pegasus->intr_urb->actual_length = 0; + intr_callback(pegasus->intr_urb, 0); + + queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, + CARRIER_CHECK_DELAY); + } return 0; } diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index dd8b4456ea35..3e341b1ffdb1 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c @@ -3732,11 +3732,17 @@ out: #ifdef CONFIG_PM -static int usbnet_suspend (struct usb_interface *intf, u32 state) +static int usbnet_suspend (struct usb_interface *intf, pm_message_t message) { struct usbnet *dev = usb_get_intfdata(intf); + /* accelerate emptying of the rx and queues, to avoid + * having everything error out. + */ netif_device_detach (dev->net); + (void) unlink_urbs (dev, &dev->rxq); + (void) unlink_urbs (dev, &dev->txq); + intf->dev.power.power_state = PMSG_SUSPEND; return 0; } @@ -3744,7 +3750,9 @@ static int usbnet_resume (struct usb_interface *intf) { struct usbnet *dev = usb_get_intfdata(intf); + intf->dev.power.power_state = PMSG_ON; netif_device_attach (dev->net); + tasklet_schedule (&dev->bh); return 0; } |