aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-09-27 13:38:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:41 -0400
commitb13296c6617f22e8c0174a7af32780617db0e680 (patch)
tree980ed483e5df92335894405ac7eb37380598190d
parent5edbfb7c8af0577097dae87cdd4dfdba82bb9579 (diff)
[PATCH] updates for "controller suspended" handling
Reject URBs to _all_ devices when their host controllers are suspended; even root hub registers will be unavailable. Also, don't reject urbs to root hubs in other cases; the only upstream link is through that controller (on PCI or whatever SOC bus is in use). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> drivers/usb/core/hcd.c | 28 ++++++++++++---------------- drivers/usb/core/urb.c | 3 ++- 2 files changed, 14 insertions(+), 17 deletions(-)
-rw-r--r--drivers/usb/core/hcd.c28
-rw-r--r--drivers/usb/core/urb.c3
2 files changed, 14 insertions, 17 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index de59bb51531..b7bb8dd1894 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -458,22 +458,18 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
458 458
459 default: 459 default:
460 /* non-generic request */ 460 /* non-generic request */
461 if (HC_IS_SUSPENDED (hcd->state)) 461 switch (typeReq) {
462 status = -EAGAIN; 462 case GetHubStatus:
463 else { 463 case GetPortStatus:
464 switch (typeReq) { 464 len = 4;
465 case GetHubStatus: 465 break;
466 case GetPortStatus: 466 case GetHubDescriptor:
467 len = 4; 467 len = sizeof (struct usb_hub_descriptor);
468 break; 468 break;
469 case GetHubDescriptor:
470 len = sizeof (struct usb_hub_descriptor);
471 break;
472 }
473 status = hcd->driver->hub_control (hcd,
474 typeReq, wValue, wIndex,
475 tbuf, wLength);
476 } 469 }
470 status = hcd->driver->hub_control (hcd,
471 typeReq, wValue, wIndex,
472 tbuf, wLength);
477 break; 473 break;
478error: 474error:
479 /* "protocol stall" on error */ 475 /* "protocol stall" on error */
@@ -487,7 +483,7 @@ error:
487 "CTRL: TypeReq=0x%x val=0x%x " 483 "CTRL: TypeReq=0x%x val=0x%x "
488 "idx=0x%x len=%d ==> %d\n", 484 "idx=0x%x len=%d ==> %d\n",
489 typeReq, wValue, wIndex, 485 typeReq, wValue, wIndex,
490 wLength, urb->status); 486 wLength, status);
491 } 487 }
492 } 488 }
493 if (len) { 489 if (len) {
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index b32898e0a27..f2a1fed2a80 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -237,7 +237,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
237 (dev->state < USB_STATE_DEFAULT) || 237 (dev->state < USB_STATE_DEFAULT) ||
238 (!dev->bus) || (dev->devnum <= 0)) 238 (!dev->bus) || (dev->devnum <= 0))
239 return -ENODEV; 239 return -ENODEV;
240 if (dev->state == USB_STATE_SUSPENDED) 240 if (dev->bus->controller->power.power_state.event != PM_EVENT_ON
241 || dev->state == USB_STATE_SUSPENDED)
241 return -EHOSTUNREACH; 242 return -EHOSTUNREACH;
242 if (!(op = dev->bus->op) || !op->submit_urb) 243 if (!(op = dev->bus->op) || !op->submit_urb)
243 return -ENODEV; 244 return -ENODEV;