Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2147168imm; Tue, 2 Oct 2018 22:19:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV60sUH0k7AiF3WMmehi+1DenYs0xcVVVfHI+if0gYBJQif3itE0OLt2iquRd5mOtt1nfCieo X-Received: by 2002:a62:9c4a:: with SMTP id f71-v6mr14373387pfe.135.1538543943988; Tue, 02 Oct 2018 22:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538543943; cv=none; d=google.com; s=arc-20160816; b=EvXKZf2YuiFka8+JRhjMiFNpMaUWtbtAeZATtdTiUjS68mRZZgETu675fpmFwiru62 MRq3dZEyHqIutDPfsRb1FUm9oImfVk7+8bGY7fo0s+k80NoVt7ENpYSs5EL1SU2cmOmn g8GS+mTZP7fZZd7nShwUxTcQDMR0Rw0AE/UOGIHjGc3smoDJaPOObsy/J0fKTmZ24iZB hmw8jKylkCKfRSOxXg3ZCbOea8OmzB1Nmeecn5rx2ttyJn1JpZHcPGV2mEgsLHWrqQYI cBaxAulnX+5meF28QdFbVTS8VKrvgWmZAfB60gFIQeQBy5QHEVQzKBj2sYxgkBC7jEdl rgZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=gvqCGAIkn71ooQyEgAKciC0DxYCmlHWOUcOsK3chEp0=; b=IudYV3CYWRwobOWZFJdgBuC/QSed4mccjOkJG/eCIoEK62R7wuXZdo8EE09V+VrVel ydNLUQ8B9e2rHq8F+tUXuonARLakP1A6pmprCFT9RE3mvns0tIdJ9I1fxpXFvar1aGZh HTWvcNbLC27b9L3QZYbOvcoWQeqFan+Cg1H7DM9ykB6cWZbKGIp8u+E2INvbEq0U1cuJ FbPmvaF4I9pwAMbhkwM6RL/Mqco1AHQe7ddPDFbTIXAb8F6ES5d6QP6RVHDTFm7AdJPX bHkbQ+QrJpE3KWoA0GRSe+RRCFpVvPiCSpDdNFKbMqt/JDveU2mzuAR5Wsx+kojAHltt IECA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 30-v6si275383pla.282.2018.10.02.22.18.48; Tue, 02 Oct 2018 22:19:03 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbeJCMFQ (ORCPT + 99 others); Wed, 3 Oct 2018 08:05:16 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54540 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726394AbeJCMFQ (ORCPT ); Wed, 3 Oct 2018 08:05:16 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1g7ZYJ-00027N-A9; Wed, 03 Oct 2018 05:18:27 +0000 From: Kai-Heng Feng To: gregkh@linuxfoundation.org Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH] usb: core: Check portchange C_PORT_RESET after resetting Date: Wed, 3 Oct 2018 13:18:22 +0800 Message-Id: <20181003051822.4011-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.17.1