Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1090531ybx; Tue, 5 Nov 2019 10:08:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwTlbJOK6/t5BnQR+cGj+rl7OIeF0zEr4p1GZ7RrlApiDzl5t2EubxWKP/4XAFs2Y2hjVo+ X-Received: by 2002:a17:906:5502:: with SMTP id r2mr31451410ejp.3.1572977329650; Tue, 05 Nov 2019 10:08:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572977329; cv=none; d=google.com; s=arc-20160816; b=uJuCMTjDi18dSndHBghmeyIcdjGEldCIoY1q4i1UwOUGEAB8kvs+7J+uvyBkFjuMi9 tb5VUlH0xPXvORdUEAxDNczoallrkfP3Q8Yv0vtRXMveqpPndp7d/LjqxtaiWRkgxrPP OEjGCIuoCS57LJADUGUb4KF8BSIDFvAUsNvTRQ6iUKUARqEK03K5LAxWVeAlz1nAPt9e po/f88JBClILs3B8n/omMlCaCVvPCQbwPTf0a5QFhPpFBpJkpAwMd1PMYalQeDH9LE8J 2NoEjZfhV2rnPycKZziit06rxQ7mpcdaSKWSKih6Zth1ao94daZMRCosBe3s1lX02bs3 BmhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=6jMAMW94/xx/S/q2VZsbRgzgYjeIYV4mQurzKZbUyqA=; b=SoNaJ+YSOUY3PbA9NGN03Wsrpx1JBGXoICS+Gu/+5dXpvHcN5m4ZoThV+TqpTGPr7M 03AU8h+uldUIB1g3u2gr9aBCDw6ZpZpqSiHP2mGnJ/16jFVoiFDXK8tq+Ee3eLAfekpu J95mh+EDo7zVs2sEvUlIEfzhbu8OEd71Jgcq04nWiot+smrZATlB3MjKbduxmTPJeRg3 AVLBbx1QccFKumpsN1jv2bA86lMThj43AW1pq7nhuTh3+lyJKl/gNOkrgwL5SjFA+cdu jScj51CD+OmtWArZofDAZc3BbldJkCCZDkr/fLbqcZbcKBreeUwb/loyaKg5J2MZd7za 7a4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z58si10898669edd.283.2019.11.05.10.08.26; Tue, 05 Nov 2019 10:08:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390616AbfKESHg (ORCPT + 99 others); Tue, 5 Nov 2019 13:07:36 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:45812 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S2390592AbfKESHf (ORCPT ); Tue, 5 Nov 2019 13:07:35 -0500 Received: (qmail 5754 invoked by uid 2102); 5 Nov 2019 13:07:34 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 5 Nov 2019 13:07:34 -0500 Date: Tue, 5 Nov 2019 13:07:34 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Kai-Heng Feng cc: gregkh@linuxfoundation.org, , , Subject: Re: [PATCH] usb: Allow USB device to be warm reset in suspended state In-Reply-To: <20191105165447.22608-1-kai.heng.feng@canonical.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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