Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2631621imm; Wed, 3 Oct 2018 06:57:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV639k8/H90BFfCjrgfhVtj8xOJevjgFNmLwDVihPd0EMZz3BSr7X2hDB1Eme3SsTdPDD9/wr X-Received: by 2002:a63:d749:: with SMTP id w9-v6mr1451849pgi.415.1538575049671; Wed, 03 Oct 2018 06:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538575049; cv=none; d=google.com; s=arc-20160816; b=ggZeZelh/MoH4yWUbwtkr5BlyD+zJLq9vQic5+m4GX931xJtc+u+Hqs3NG+wsz6mDk D6gDmDkuo9giaHw67zXpJpcJw4mMaOYQqQjpZtaugiWz8LH2StcX/SytoaEg62LIeKbt UOLeSxRVuNHGGPXZcUIkdOywd5BRmpHQS/F2d+NWGNmnuCAwjH4I5gkIKeFx8ywNTExf NmcvqVtetHvndygZtuMl1DUr9EbbtlJtTdKEb+dmQ9sgCeKecmO6SozDKSkMO9VpkMLj ldVsCor88J+Bre24F3w72B0M3D4/y4qFzcPvHqCvOLLCqCPPI59FW0yAM3hQxW3sZTL8 klyw== 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=g+txll7y5+23zxmTtpF1Bu+l6lEtwovuKc9sPBbzN1c=; b=WXLRTFJC+gnfE1L7gDUjcr4L6xWyELIvAApw6rg5IszS2KjcEoy3QEApoIr4/EK6x0 FU+WaxQrDRJS1nk9qcBx23FW074YUxVEHxks9vQrH+T4ZfD9MDIhXf6ObCbqPvAtGyCd j1WNSVieg4+7yrClIucT90cm1GGe86dvyJO6HOnEmRQAtPD6cAP+rcKP83QnJ/q1L95b +ISMICsZ3RhCw/Be/g0ly75YRd2mBjtZXxo/jWLdXo5jSG1nNKdJr0gyumlRrhIAMAC+ ADxplyFIB6AuzpS9basFKB3EsoRoQVX0JlJefrS3nFr6/5vu8N7ROTCqrRvCLOlEBmKR QAew== 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 e7-v6si1693522pls.366.2018.10.03.06.57.13; Wed, 03 Oct 2018 06:57:29 -0700 (PDT) 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 S1726997AbeJCUpi (ORCPT + 99 others); Wed, 3 Oct 2018 16:45:38 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:48678 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726769AbeJCUpi (ORCPT ); Wed, 3 Oct 2018 16:45:38 -0400 Received: (qmail 1563 invoked by uid 2102); 3 Oct 2018 09:57:06 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 3 Oct 2018 09:57:06 -0400 Date: Wed, 3 Oct 2018 09:57:06 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Kai-Heng Feng cc: gregkh@linuxfoundation.org, , Subject: Re: [PATCH] usb: core: Check portchange C_PORT_RESET after resetting In-Reply-To: <20181003051822.4011-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, 3 Oct 2018, Kai-Heng Feng wrote: > Based on USB2.0 Spec Section 11.24.2.7.2.5: > > "This bit is set when the port transitions from the Resetting state (or, > if present, the Speed_eval state) to the Enabled state." > > Also Section 11.24.2.13: > > "Setting the reset feature PORT_RESET causes the hub to signal reset on > that port. When the reset signaling is complete, the hub sets the > C_PORT_RESET status change and immediately enables the port." > > So let's also check C_PORT_RESET for reset completion. > > Signed-off-by: Kai-Heng Feng > --- > drivers/usb/core/hub.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index 7801bb30bdba..d96058372280 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -2721,7 +2721,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, > * so also wait for the connection to be re-established. > */ > if (!(portstatus & USB_PORT_STAT_RESET) && > - (portstatus & USB_PORT_STAT_CONNECTION)) > + (portstatus & USB_PORT_STAT_CONNECTION) && > + (portchange & USB_PORT_STAT_C_RESET)) > break; > > /* switch to the long delay after two short delay failures */ What is the purpose of this patch? Does it fix a problem? Alan Stern