tree 791a046b5d860233f652973d0627752b67a3c600
parent c6053ecffb895f6c0e0ec9c1d298e35cffc1f7a6
author David Brownell <[EMAIL PROTECTED]> Tue, 19 Apr 2005 07:39:22 -0700
committer Greg K-H <[EMAIL PROTECTED]> Tue, 19 Apr 2005 07:39:22 -0700
[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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
Index: gregkh-2.6/drivers/net/irda/stir4200.c
===================================================================
net/irda/stir4200.c | 4 ++--
usb/core/hub.c | 4 ++--
usb/core/usb.c | 6 +++---
usb/input/hid-core.c | 6 +++---
usb/net/pegasus.c | 22 +++++++++++++++++++++-
usb/net/usbnet.c | 10 +++++++++-
linux/usb.h | 4 ++--
7 files changed, 42 insertions(+), 14 deletions(-)
Index: drivers/net/irda/stir4200.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/net/irda/stir4200.c
(mode:100644 sha1:83c605e8824c89e714dabac99d4c40287cccf1c5)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/net/irda/stir4200.c
(mode:100644 sha1:66f488c13717415b151c1bb1ad5442c09e4486e5)
@@ -1128,8 +1128,8 @@
}
#ifdef CONFIG_PM
-/* Power management suspend, so power off the transmitter/receiver */
-static int stir_suspend(struct usb_interface *intf, u32 state)
+/* USB suspend, so power off the transmitter/receiver */
+static int stir_suspend(struct usb_interface *intf, pm_message_t message)
{
struct stir_cb *stir = usb_get_intfdata(intf);
Index: drivers/usb/core/hub.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/usb/core/hub.c
(mode:100644 sha1:fa0dc4f6de47380da80935de2a2d750affb46e63)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/usb/core/hub.c
(mode:100644 sha1:94f7d2d1faf69276f1c3a724a037f587b917cd85)
@@ -1731,7 +1731,7 @@
struct usb_driver *driver;
intf = udev->actconfig->interface[i];
- if (intf->dev.power.power_state == PM_SUSPEND_ON)
+ if (intf->dev.power.power_state == PMSG_SUSPEND)
continue;
if (!intf->dev.driver) {
/* FIXME maybe force to alt 0 */
@@ -1745,7 +1745,7 @@
/* can we do better than just logging errors? */
status = driver->resume(intf);
- if (intf->dev.power.power_state != PM_SUSPEND_ON
+ if (intf->dev.power.power_state != PMSG_ON
|| status)
dev_dbg(&intf->dev,
"resume fail, state %d code %d\n",
Index: drivers/usb/core/usb.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/usb/core/usb.c
(mode:100644 sha1:f0534ee064901d0108eb7b2b1fcb59a98bb53c2b)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/usb/core/usb.c
(mode:100644 sha1:5e45996b5a441d94c89f8fa94db2bf66f8ca8e93)
@@ -1382,13 +1382,13 @@
usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE);
}
-static int usb_generic_suspend(struct device *dev, u32 state)
+static int usb_generic_suspend(struct device *dev, pm_message_t message)
{
struct usb_interface *intf;
struct usb_driver *driver;
if (dev->driver == &usb_generic_driver)
- return usb_suspend_device (to_usb_device(dev), state);
+ return usb_suspend_device (to_usb_device(dev), message);
if ((dev->driver == NULL) ||
(dev->driver_data == &usb_generic_driver_data))
@@ -1402,7 +1402,7 @@
return 0;
if (driver->suspend)
- return driver->suspend(intf, state);
+ return driver->suspend(intf, message);
return 0;
}
Index: drivers/usb/input/hid-core.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/usb/input/hid-core.c
(mode:100644 sha1:7662cf4e262152de1958c315959ce8b0555633a0)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/usb/input/hid-core.c
(mode:100644 sha1:e625997694df9f5ee5fa96a32323b552dd2a1794)
@@ -1790,12 +1790,12 @@
return 0;
}
-static int hid_suspend(struct usb_interface *intf, u32 state)
+static int hid_suspend(struct usb_interface *intf, pm_message_t message)
{
struct hid_device *hid = usb_get_intfdata (intf);
usb_kill_urb(hid->urbin);
- intf->dev.power.power_state = state;
+ intf->dev.power.power_state = PMSG_SUSPEND;
dev_dbg(&intf->dev, "suspend\n");
return 0;
}
@@ -1805,7 +1805,7 @@
struct hid_device *hid = usb_get_intfdata (intf);
int status;
- intf->dev.power.power_state = PM_SUSPEND_ON;
+ intf->dev.power.power_state = PMSG_ON;
if (hid->open)
status = usb_submit_urb(hid->urbin, GFP_NOIO);
else
Index: drivers/usb/net/pegasus.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/usb/net/pegasus.c
(mode:100644 sha1:f6c19d73b7da9b1591ae25a6f1ab1d8e6d31af35)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/usb/net/pegasus.c
(mode:100644 sha1:a02be795d63e7ab898aab82fe985c3969b86aaf4)
@@ -1364,11 +1364,18 @@
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 @@
{
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;
}
Index: drivers/usb/net/usbnet.c
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/drivers/usb/net/usbnet.c
(mode:100644 sha1:dd8b4456ea35e2fb4882f76b173c250f4114eaf1)
+++ 791a046b5d860233f652973d0627752b67a3c600/drivers/usb/net/usbnet.c
(mode:100644 sha1:3e341b1ffdb1907fc808408db72e88013e0ca3ac)
@@ -3732,11 +3732,17 @@
#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 @@
{
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;
}
Index: include/linux/usb.h
===================================================================
--- 9f3d796b1f41338bf276c82b58d260125541e8a0/include/linux/usb.h (mode:100644
sha1:c96728435935b1e90e709c70a030736d35fc2c62)
+++ 791a046b5d860233f652973d0627752b67a3c600/include/linux/usb.h (mode:100644
sha1:41d1a644c9d43aa8206cf2b6e708c4a8173b7fd2)
@@ -558,7 +558,7 @@
int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf);
- int (*suspend) (struct usb_interface *intf, u32 state);
+ int (*suspend) (struct usb_interface *intf, pm_message_t message);
int (*resume) (struct usb_interface *intf);
const struct usb_device_id *id_table;
@@ -977,7 +977,7 @@
int timeout);
/* selective suspend/resume */
-extern int usb_suspend_device(struct usb_device *dev, u32 state);
+extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
extern int usb_resume_device(struct usb_device *dev);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html