Re: [PATCH] usb: Allow USB device to be warm reset in suspended state

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

 



On Wed, 6 Nov 2019, Kai-Heng Feng wrote:

> On Dell WD15 dock, sometimes USB ethernet cannot be detected after plugging
> cable to the ethernet port, the hub and roothub get runtime resumed and
> runtime suspended immediately:
> ...

> ...
> 
> As Mathias pointed out, the hub enters Cold Attach Status state and
> requires a warm reset. However usb_reset_device() bails out early when
> the device is in suspended state, as its callers port_event() and
> hub_event() don't always resume the device.
> 
> Since there's nothing wrong to reset a suspended device, allow
> usb_reset_device() to do so to solve the issue.

I was sure I remembered reading somewhere that suspended devices were
not allowed to be reset, but now I can't find that requirement anywhere
in the USB spec.

> Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
> ---
>  drivers/usb/core/hub.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 05a2d51bdbe0..f0194fdbc9b8 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -5877,8 +5877,7 @@ int usb_reset_device(struct usb_device *udev)
>  	struct usb_host_config *config = udev->actconfig;
>  	struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
>  
> -	if (udev->state == USB_STATE_NOTATTACHED ||
> -			udev->state == USB_STATE_SUSPENDED) {
> +	if (udev->state == USB_STATE_NOTATTACHED) {
>  		dev_dbg(&udev->dev, "device reset not allowed in state %d\n",
>  				udev->state);
>  		return -EINVAL;

You forgot to update the kerneldoc for this function.

Alan Stern




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

  Powered by Linux