summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2004-04-30 08:19:00 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2004-04-30 08:19:00 -0700
commite6ff3ede93b9ecd0661cdc03511d9ab4f70bcc25 (patch)
treeedfd03cd794eee39750d4926f82681e600060f38
parenteb9f952ac35fa55dcec5f5cb40ec6cc25ea52ec8 (diff)
[PATCH] USB: reject urb submissions to suspended devices
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.
-rw-r--r--drivers/usb/core/hcd-pci.c6
-rw-r--r--drivers/usb/core/hcd.h2
-rw-r--r--drivers/usb/core/urb.c2
3 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 5cba0648ec7d..0aa8af55ef48 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -293,7 +293,7 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
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 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, u32 state)
"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 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
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;
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index 388b1995aa33..c7876b2552fb 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -96,7 +96,7 @@ struct usb_hcd { /* usb_bus.hcpriv points to this */
# 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)
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c31f2393230c..25d5d1926ba9 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -237,6 +237,8 @@ int usb_submit_urb(struct urb *urb, int mem_flags)
(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;