Pull acpi_device_handle_cleanup into release branch
[pandora-kernel.git] / drivers / usb / core / urb.c
index b32898e..9864988 100644 (file)
@@ -1,15 +1,8 @@
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/bitops.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-
-#ifdef CONFIG_USB_DEBUG
-       #define DEBUG
-#else
-       #undef DEBUG
-#endif
 #include <linux/usb.h>
 #include "hcd.h"
 
@@ -237,7 +230,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
            (dev->state < USB_STATE_DEFAULT) ||
            (!dev->bus) || (dev->devnum <= 0))
                return -ENODEV;
-       if (dev->state == USB_STATE_SUSPENDED)
+       if (dev->bus->controller->power.power_state.event != PM_EVENT_ON
+                       || dev->state == USB_STATE_SUSPENDED)
                return -EHOSTUNREACH;
        if (!(op = dev->bus->op) || !op->submit_urb)
                return -ENODEV;
@@ -473,6 +467,7 @@ int usb_unlink_urb(struct urb *urb)
  */
 void usb_kill_urb(struct urb *urb)
 {
+       might_sleep();
        if (!(urb && urb->dev && urb->dev->bus && urb->dev->bus->op))
                return;
        spin_lock_irq(&urb->lock);