Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b13296c6 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman
Browse files

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/core/hcd.c |   28 ++++++++++++----------------
 drivers/usb/core/urb.c |    3 ++-
 2 files changed, 14 insertions(+), 17 deletions(-)
parent 5edbfb7c
Loading
Loading
Loading
Loading
+12 −16
Original line number Original line Diff line number Diff line
@@ -458,9 +458,6 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)


	default:
	default:
		/* non-generic request */
		/* non-generic request */
		if (HC_IS_SUSPENDED (hcd->state))
			status = -EAGAIN;
		else {
		switch (typeReq) {
		switch (typeReq) {
		case GetHubStatus:
		case GetHubStatus:
		case GetPortStatus:
		case GetPortStatus:
@@ -473,7 +470,6 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
		status = hcd->driver->hub_control (hcd,
		status = hcd->driver->hub_control (hcd,
			typeReq, wValue, wIndex,
			typeReq, wValue, wIndex,
			tbuf, wLength);
			tbuf, wLength);
		}
		break;
		break;
error:
error:
		/* "protocol stall" on error */
		/* "protocol stall" on error */
@@ -487,7 +483,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
				"CTRL: TypeReq=0x%x val=0x%x "
				"CTRL: TypeReq=0x%x val=0x%x "
				"idx=0x%x len=%d ==> %d\n",
				"idx=0x%x len=%d ==> %d\n",
				typeReq, wValue, wIndex,
				typeReq, wValue, wIndex,
				wLength, urb->status);
				wLength, status);
		}
		}
	}
	}
	if (len) {
	if (len) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -237,7 +237,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
	    (dev->state < USB_STATE_DEFAULT) ||
	    (dev->state < USB_STATE_DEFAULT) ||
	    (!dev->bus) || (dev->devnum <= 0))
	    (!dev->bus) || (dev->devnum <= 0))
		return -ENODEV;
		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;
		return -EHOSTUNREACH;
	if (!(op = dev->bus->op) || !op->submit_urb)
	if (!(op = dev->bus->op) || !op->submit_urb)
		return -ENODEV;
		return -ENODEV;