This patch rejects URB submissions to suspended devices, so that they don't get hardware-specific fault reports. Instead, they get the same code (-EHOSTUNREACH) for all HCDs.
It also fixes a minor problem with colliding declarations of the symbol USB_STATE_SUSPENDED.
Please merge.
- Dave
--- 1.29/drivers/usb/core/hcd-pci.c Fri Apr 23 19:40:46 2004
+++ edited/drivers/usb/core/hcd-pci.c Wed Apr 28 13:57:24 2004
@@ -293,7 +293,7 @@
case USB_STATE_HALT:
dev_dbg (hcd->self.controller, "halted; hcd not suspended\n");
break;
- case USB_STATE_SUSPENDED:
+ case HCD_STATE_SUSPENDED:
dev_dbg (hcd->self.controller, "hcd already suspended\n");
break;
default:
@@ -310,7 +310,7 @@
"suspend fail, retval %d\n",
retval);
else
- hcd->state = USB_STATE_SUSPENDED;
+ hcd->state = HCD_STATE_SUSPENDED;
}
pci_set_power_state (dev, state);
@@ -333,7 +333,7 @@
dev_dbg (hcd->self.controller, "resume from state D%d\n",
dev->current_state);
- if (hcd->state != USB_STATE_SUSPENDED) {
+ if (hcd->state != HCD_STATE_SUSPENDED) {
dev_dbg (hcd->self.controller,
"can't resume, not suspended!\n");
return -EL3HLT;
--- 1.40/drivers/usb/core/hcd.h Wed Apr 14 19:54:51 2004
+++ edited/drivers/usb/core/hcd.h Wed Apr 28 14:01:03 2004
@@ -96,7 +96,7 @@
# define USB_STATE_RUNNING (__ACTIVE)
# define USB_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
# define USB_STATE_RESUMING (__SUSPEND|__TRANSIENT)
-# define USB_STATE_SUSPENDED (__SUSPEND)
+# define HCD_STATE_SUSPENDED (__SUSPEND)
#define HCD_IS_RUNNING(state) ((state) & __ACTIVE)
#define HCD_IS_SUSPENDED(state) ((state) & __SUSPEND)
--- 1.22/drivers/usb/core/urb.c Tue Mar 16 19:12:27 2004
+++ edited/drivers/usb/core/urb.c Wed Apr 28 14:00:02 2004
@@ -232,6 +232,8 @@
(dev->state < USB_STATE_DEFAULT) ||
(!dev->bus) || (dev->devnum <= 0))
return -ENODEV;
+ if (dev->state == USB_STATE_SUSPENDED)
+ return -EHOSTUNREACH;
if (!(op = dev->bus->op) || !op->submit_urb)
return -ENODEV;
