}
#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);
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 */
/* 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",
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))
return 0;
if (driver->suspend)
- return driver->suspend(intf, state);
+ return driver->suspend(intf, message);
return 0;
}
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;
}
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
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;
}
{
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;
}
#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;
}
{
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;
}
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;
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);