Re: [PATCH] xhci: Tell USB core both roothubs lost power.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 13, 2011 at 05:56:48PM -0400, Alan Stern wrote:
> On Wed, 13 Apr 2011, Sarah Sharp wrote:
> 
> > Cai, will you try the following patch with Andiry's work-around patch,
> > but not with Alan's patch?
> > 
> > This solves the 2nd hibernate failure for me.  I think Alan's patch was
> > masking underlying issues when the USB 3.0 roothub was not marked as
> > having lost power.  The USB core really thought the USB 3.0 hard drive
> > was still there, which is why can_submit was set.  Alan, do you think
> > your patch is still needed?
> 
> No, it's not needed, but something else is.  The patch was written to
> solve a real problem: What should we do if a device is unplugged during
> a system sleep transition?  Since khubd gets frozen before the
> transition starts, the device can't be unregistered -- and it can't be
> suspended.
> 
> What do you think of the patch below instead?  It actually does a
> better job of solving the underlying problem... although it does a
> worse job of reducing the code size.  :-)
> 
> Alan Stern
> 
> 
> 
> Index: usb-2.6/drivers/usb/core/hub.c
> ===================================================================
> --- usb-2.6.orig/drivers/usb/core/hub.c
> +++ usb-2.6/drivers/usb/core/hub.c
> @@ -2296,6 +2296,16 @@ int usb_port_suspend(struct usb_device *
>  				USB_DEVICE_REMOTE_WAKEUP, 0,
>  				NULL, 0,
>  				USB_CTRL_SET_TIMEOUT);
> +
> +		/* Failure to suspend is okay if the port isn't enabled */
> +		if (!(msg.event & PM_EVENT_AUTO)) {
> +			u16 pstatus, pchange;
> +
> +			pstatus = 0;
> +			hub_port_status(hub, port1, &pstatus, &pchange);
> +			if (!(pstatus & USB_PORT_STAT_ENABLE))
> +				status = 0;
> +		}
>  	} else {
>  		/* device has up to 10 msec to fully suspend */
>  		dev_dbg(&udev->dev, "usb %ssuspend\n",

So we'll only return a successful status if this isn't an auto-suspend,
and the port is disabled, correct?  Remember that USB 3.0 ports can't be
disabled, because USB 3.0 hubs don't define a ClearPortFeature
PORT_ENABLE like USB 2.0 hubs do.  This won't help for any USB 3.0
devices.

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux