Commit e6ff3ede authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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.
parent eb9f952a
......@@ -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;
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment