On Wed, 6 Apr 2016, Mathias Nyman wrote:

> We don't want to runtime suspend a bus if there is an event pending.
> The roothub on a NEC uPD720200 host with a single USB3 device connected
> might go back to runtime suspend immediately after runtime resume as
> hub might not yet see any port changes in resume.
> 
> Prevent this by checking if there is a unhandled event pending when
> calling runtime suspend.
> 
> Cc: <sta...@vger.kernel.org>
> Tested-by: Mike Murdoch <main.ha...@gmail.com>
> Signed-off-by: Mathias Nyman <mathias.ny...@linux.intel.com>
> ---
>  drivers/usb/host/xhci-hub.c | 6 ++++++
>  drivers/usb/host/xhci.c     | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
> index d61fcc4..7e8999a 100644
> --- a/drivers/usb/host/xhci-hub.c
> +++ b/drivers/usb/host/xhci-hub.c
> @@ -1289,12 +1289,18 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
>       __le32 __iomem **port_array;
>       struct xhci_bus_state *bus_state;
>       unsigned long flags;
> +     u32 status;
>  
>       max_ports = xhci_get_ports(hcd, &port_array);
>       bus_state = &xhci->bus_state[hcd_index(hcd)];
>  
>       spin_lock_irqsave(&xhci->lock, flags);
>  
> +     /* Don't suspend root hub if there's an event pending. */
> +     status = readl(&xhci->op_regs->status);
> +     if (status & STS_EINT)
> +             return -EBUSY;

Does anybody else see a problem here?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to